class Git::Error


@api public
@see Git::UnexpectedResultError
@see Git::ProcessIOError
@see Git::TimeoutError
@see Git::SignaledError
@see Git::FailedError
@see Git::CommandLineError
end
puts “Received the following error: #{e}”
rescue Git::Error => e
puts “Git clone took too long and timed out #{e}”
rescue Git::TimeoutError => e # Catch the more specific error first!
repo = Git.clone(‘github.com/ruby-git/ruby-git’, ‘ruby-git-temp’, timeout: timeout_duration)
timeout_duration = 0.001 # seconds
begin
@example Rescuing a timeout error
end
puts “An error occurred: #{e.message}”
rescue Git::Error => e
# some git operation
begin
@example Rescuing a generic error
| ‘UnexpectedResultError` | The command line ran without error but did not return the expected results. |
| `ProcessIOError` | An error was encountered reading or writing to a subprocess. |
| `TimeoutError` | This is a specific type of `SignaledError` that is raised when the git command line operation times out and is killed via the SIGKILL signal. This happens if the operation takes longer than the timeout duration configured in `Git.config.timeout` or via the `:timeout` parameter given in git methods that support timeouts. |
| `SignaledError` | This error is raised when the git command line 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` | This error is raised when the git command line exits with a non-zero status code that is not expected by the git gem. |
| `CommandLineError` | A subclass of this error is raised when there is a problem executing the git command line. |
| `Error` | This catch-all error serves as the base class for other custom errors raised by the git gem. |
| — | — |
| Error Class | Description |
“`
└─> Git::UnexpectedResultError
├─> Git::ProcessIOError
│ └─> Git::TimeoutError
│ └─> Git::SignaledError
│ ├─> Git::FailedError
├─> Git::CommandLineError
└─> Git::Error
StandardError
“`text
Git’s custom errors are arranged in the following class heirarchy:
this gem unless you need more specific error handling.
It is recommended to rescue ‘Git::Error` to catch any runtime error raised by
`Git::Error`. It does not explicitly raise any other types of errors.
The git gem will only raise an `ArgumentError` or an error that is a subclass of
Base class for all custom git module errors