class ProcessExecuter::Error
@api public
end
puts “Some other error occurred: #{e}”
rescue ProcessExecuter::Error => e
puts “Command took too long and timed out: #{e}”
rescue ProcessExecuter::TimeoutError => e # Catch the more specific error first!
ProcessExecuter.run(‘sleep’, ‘1’, timeout_after:)
timeout_after = 0.1 # seconds
begin
@example Rescuing a timeout error
end
puts “An error occurred: #{e.message}”
rescue ProcessExecuter::Error => e
ProcessExecuter.run(‘git’, ‘status’)
begin
@example Rescuing any error
| ‘SpawnError` | Raised when the process could not execute. Check the `#cause` for the original exception from `Process.spawn`. |
| `ProcessIOError` | Raised when an error was encountered reading or writing to the command’s subprocess. |
| ‘TimeoutError` | This is a specific type of `SignaledError` that is raised when the command times out and is killed via the SIGKILL signal. |
| `SignaledError` | Raised when the command is terminated as a result of receiving a signal. This could happen if the process is forcibly terminated or if there is a serious system error. |
| `FailedError` | Raised when the command exits with a non-zero exit status. |
| `CommandError` | A subclass of this error is raised when there is a problem executing a command. |
| `ArgumentError` | Raised when an invalid argument is passed to a method. |
| `Error` | This catch-all error serves as the base class for other custom errors. |
| — | — |
| Error Class | Description |
“`
└─> SpawnError
├─> ProcessIOError
│ └─> TimeoutError
│ └─> SignaledError
│ ├─> FailedError
├─> CommandError
├─> ArgumentError
└─> Error
::StandardError
“`text
Custom errors are arranged in the following class hierarchy:
raised by this gem unless you need more specific error handling.
It is recommended to rescue {ProcessExecuter::Error} to catch any runtime error
Base class for all {ProcessExecuter} errors