Module: Gel::ReportableError
- Included in:
- UserError
- Defined in:
- lib/gel/error.rb
Instance Method Summary collapse
-
#details ⇒ Object
Include this module into any exception that should be treated as a “user facing error” – that means an error that’s user reportable, not necessarily that it’s their fault.
- #exit_code ⇒ Object
Instance Method Details
#details ⇒ Object
Include this module into any exception that should be treated as a “user facing error” – that means an error that’s user reportable, not necessarily that it’s their fault.
Examples of things that are user-facing errors:
* unknown subcommand / arguments
* requesting an unknown gem, or one with a malformed name
* problems talking to a gem source
* syntax errors inside a Gemfile or Gemfile.lock
* dependency resolution failure
* problems compiling or installing a gem
In general, anything that’s expected to possibly go wrong should at some point be wrapped in a user error describing the problem in terms of what they wanted to do. An unwrapped exception reaching the top in Command#run is a bug: either the exception is itself reporting a bug (nil reference, typo on a method name, etc), or if it’s a legitimate failure, then the bug is a missing rescue.
23 24 |
# File 'lib/gel/error.rb', line 23 def details end |
#exit_code ⇒ Object
26 27 28 |
# File 'lib/gel/error.rb', line 26 def exit_code 1 end |