Exception: ShellHelpers::FailedCommandError
- Inherits:
-
StandardError
- Object
- StandardError
- ShellHelpers::FailedCommandError
- Defined in:
- lib/shell_helpers/sh.rb
Overview
FailedCommandError {{{ Thrown by certain methods when an externally-called command exits nonzero
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
The command that caused the failure.
Instance Method Summary collapse
-
#initialize(exit_code, command, failure_msg: nil) ⇒ FailedCommandError
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
#initialize(exit_code, command, failure_msg: nil) ⇒ FailedCommandError
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.
139 140 141 142 143 |
# File 'lib/shell_helpers/sh.rb', line 139 def initialize(exit_code,command,failure_msg: nil) = String(failure_msg).empty? ? "Command '#{command}' exited #{exit_code}" : failure_msg super() @command = command end |
Instance Attribute Details
#command ⇒ Object (readonly)
The command that caused the failure
133 134 135 |
# File 'lib/shell_helpers/sh.rb', line 133 def command @command end |