Exception: Methadone::FailedCommandError
- Inherits:
-
Error
- Object
- StandardError
- Error
- Methadone::FailedCommandError
- Defined in:
- lib/methadone/error.rb
Overview
Thrown by certain methods when an externally-called command exits nonzero
Instance Attribute Summary (collapse)
-
- (Object) command
readonly
The command that caused the failure.
Attributes inherited from Error
Instance Method Summary (collapse)
-
- (FailedCommandError) initialize(exit_code, command, custom_error_message = nil)
constructor
exit_code
exit code of the command that caused this
command
the entire command-line that caused this
custom_error_message
an error message to show the user instead of the boilerplate one.
Constructor Details
- (FailedCommandError) initialize(exit_code, command, custom_error_message = nil)
exit_code |
exit code of the command that caused this |
command |
the entire command-line that caused this |
custom_error_message |
an error message to show the user instead of the boilerplate one. Useful for allowing this exception to bubble up and exit the program, but to give the user something actionable. |
26 27 28 29 30 |
# File 'lib/methadone/error.rb', line 26 def initialize(exit_code,command, = nil) = String().empty? ? "Command '#{command}' exited #{exit_code}" : super(exit_code,) @command = command end |
Instance Attribute Details
- (Object) command (readonly)
The command that caused the failure
19 20 21 |
# File 'lib/methadone/error.rb', line 19 def command @command end |