Refactor the Error heriarchy #693
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Your checklist for this pull request
🚨Please review the guidelines for contributing to this repository.
Description
This PR redesigns the custom errors defined by this gem. Here is a description of the new design from the updated README.md:
This gem raises custom errors that derive from
Git::Error
. These errors arearranged in the following class heirarchy:
Error heirarchy:
Other standard errors may also be raised like
ArgumentError
. Each method shoulddocument the errors it may raise.
Description of each Error class:
Error
: This catch-all error serves as the base class for other custom errors in thisgem. Errors of this class are raised when no more approriate specific error to
raise.
CommandLineError
: This error is raised when there's a problem executing the gitcommand line. This gem will raise a more specific error depending on how the
command line failed.
FailedError
: This error is raised when the git command line exits with a non-zerostatus code that is not expected by the git gem.
SignaledError
: This error is raised when the git command line is terminated as aresult of receiving a signal. This could happen if the process is forcibly
terminated or if there is a serious system error.
TimeoutError
: This is a specific type ofSignaledError
that is raised when thegit 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 thatsupport this parameter.
Git::GitExecuteError
remains as an alias forGit::Error
. It is considereddeprecated as of git-2.0.0.
Here is an example of catching errors when using the git gem: