Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor errors that are raised by this gem #709

Merged
merged 1 commit into from
May 6, 2024
Merged

Conversation

jcouball
Copy link
Member

@jcouball jcouball commented May 5, 2024

Refactor the errors raised by this gem into this hierarchy of classes defined in the Git module:

Error
├─> CommandLineError
│   ├─> FailedError
│   └─> SignaledError
│       └─> TimeoutError
├─> ProcessIOError
└─> UnexpectedResultError

Other standard errors may also be raised like ArgumentError. Each method should document 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 this
    gem. This gem only raises errors that are a subclass of Git::Error.
  • CommandLineError: This error is raised when there's a problem executing the git
    command 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-zero
    status code that is not expected by the git gem.
  • 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.
  • 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 this parameter.
  • ProcessIOError: An error was encountered reading or writing to a subprocess.
  • UnexpectedResultError: The command line ran without error but did not return
    the expected results.

For backward compatability, Git::GitExecuteError remains as an alias for Git::Error. It is considered
deprecated as of v2.0.0 and will be remove in v3.0.0.

@jcouball jcouball force-pushed the refactor_errors branch 3 times, most recently from 66b98c2 to 2c0a55d Compare May 6, 2024 15:25
Signed-off-by: James Couball <jcouball@yahoo.com>
@jcouball jcouball merged commit 7376d76 into master May 6, 2024
8 checks passed
@jcouball jcouball deleted the refactor_errors branch May 6, 2024 15:49
@jcouball
Copy link
Member Author

Incidentally, this PR fixes #657 as activesupport was integrated in order to mark the original error class as deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant