Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(error): Allow removing context from errors #5246

Closed
wants to merge 1 commit into from

Conversation

Morganamilo
Copy link

No description provided.

@Morganamilo Morganamilo changed the title feat(error): allow removing context from errors feat(error): Allow removing context from errors Dec 4, 2023
@epage
Copy link
Member

epage commented Dec 4, 2023

Generally, API changes like this should start with an issue before getting to being a PR.

Either way, before I will consider a change like this, we need to discuss the cases involved.

@epage epage marked this pull request as draft December 4, 2023 15:36
@Morganamilo Morganamilo marked this pull request as ready for review December 4, 2023 16:58
@Morganamilo Morganamilo marked this pull request as draft December 4, 2023 17:00
@Morganamilo
Copy link
Author

The change was so small with and with only one way to do it I thought it would be simpler to make a PR.

My use case is I like short one line error messages without too much flufff. But I do at least want the context to tell me the name of the flag that was invalid.

So removing the suggestion context from the error does this for me without having to reinvent the wheel with a whole new error formatted.

Plus there was already a public function to add context so I assumed a matching remove only made sense.

@epage
Copy link
Member

epage commented Dec 4, 2023

The official way to customize things is by providing your own Context formatter.

@Morganamilo
Copy link
Author

Morganamilo commented Dec 4, 2023

How would my own custom Error Formatter access things like error.inner.styles, error.inner.help_flag and error.inner.help_flag?

@epage
Copy link
Member

epage commented Dec 4, 2023

If there is functionality missing for writing a custom error, that can be addressed.

I think this PR shows why I ask for Issues and I'm closing this as we've held too much of a pertinent conversation in a potentially dead end location.

@epage epage closed this Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants