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

Expose ArguParseException or similar for use within apps #175

Closed
bartelink opened this issue May 28, 2022 · 2 comments
Closed

Expose ArguParseException or similar for use within apps #175

bartelink opened this issue May 28, 2022 · 2 comments

Comments

@bartelink
Copy link
Member

Description

Would like a way to throw ArguParseException, either directly or indirectly via a helper.

e.g. missingArg or invalidCommand of string -> 'a that would raise (ArguParseException("ERROR: " + message)) or similar

Expected behavior

Can handle 2% of cases where I determine that semantics have been contravened by the invocation, but can't represent that rule via attributes and/or Argu API calls

Actual behavior

Need to define my own exception for that, and then remember to handle it explicitly as I already need to for ArguParseException

Known workarounds

In Equinox, Propulsion and some closed source apps, I and others have established a convention of having a secondary exception (MissingArg)

@bartelink
Copy link
Member Author

I do appreciate that there is a value in ArguParseException being known and trusted to only be throwable indirectly by invoking Argu operations.

If the exception was a type rather than an exception, I'd be proposing a derived Exception type as a solution that solves my desire to be able to filter with a single type check pattern, but I suspect that's a bridge too far.

Am absolutely interested in spike PRs that demonstrate cleaner ways to handle cases where e.g. I'm seeking to convey programmatically that that some combination of arguments are missing and/or illegal.

@bartelink
Copy link
Member Author

@bartelink bartelink closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 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

No branches or pull requests

1 participant