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

[Ftr] Succint error messages that don't show spec boilerplate #136

Open
kiramclean opened this issue Feb 24, 2021 · 1 comment
Open

[Ftr] Succint error messages that don't show spec boilerplate #136

kiramclean opened this issue Feb 24, 2021 · 1 comment

Comments

@kiramclean
Copy link

Is your feature request related to a problem? Please describe.
This is not a big problem, just a mere suggestion. I'm proposing making the error messages just short, simple messages, without showing anything related to spec. E.g. at the moment I've got a small CLI set up where one of the arguments is an input directory. I use spec validation to check that the directory exists, and expound to add a nicer error message, but the user still sees this unwieldy message if they pass in something that fails the validation:

** ERROR: **
Global option error: Spec failure for global option 'input'
-- Spec failed --------------------

  "/Users/kira/does/not/exist"

Directory must exist.

-- Relevant specs -------

:indexer.core/input-dir:
  babashka.fs/exists?

-------------------------
Detected 1 error

(The "directory must exist" part is my custom expound message).

Also I should add it's entirely possible that I've just got it set up wrong. I'm notoriously mediocre at using other people's libraries with success. The app config can be found in this public repo.

Describe the solution you'd like
It would be more conventional and I'd argue more user-friendly if the error message were simply something like "An error occurred: Directory must exist." (or "directory was not found. Please provide a directory that exists", or whatever).

Describe alternatives you've considered
I like how high-level cli-matic is, so I get that maybe it wouldn't make sense to give the (library) user full control over the entire error message, but omitting the spec stuff should be an option, imo.

Thank you for this great library, and for reading this issue!

@l3nz
Copy link
Owner

l3nz commented Apr 19, 2021

The idea of Expound was having messages (especially with Spec) that made a bit more sense than the usual 100+ lines of headache.

Maybe your issue could be that you would like an escape hatch so you can generate a custom message by triggering an exception?

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

2 participants