-
Notifications
You must be signed in to change notification settings - Fork 72
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
Error class revamp (part 2) #143
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Daniel Colson <composerinteralia@github.com>
Co-authored-by: Daniel Colson <composerinteralia@github.com>
Co-authored-by: Daniel Colson <composerinteralia@github.com>
Without this Trilogy::SyscallError::* matches all matching instances of ::Errno::*, which makes the subclass useless in differentiating. Co-authored-by: Daniel Colson <composerinteralia@github.com>
This should be its own error class, it does not come from an ETIMEDOUT, and inheriting from that makes this class hard to differentiate. Co-authored-by: Daniel Colson <composerinteralia@github.com>
adrianna-chang-shopify
approved these changes
Jan 2, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
composerinteralia
added a commit
to composerinteralia/rails
that referenced
this pull request
Jan 23, 2024
At GitHub we get a fair number of Trilogy `ETIMEDOUT` errors (for known reasons that we might be able to improve somewhat, but I doubt we'll make them go away entirely). These are very much retryable network errors, so it'd be handy if these `ETIMEDOUT` errors were translated to `ConnectionFailed` instead of `StatementInvalid`, making them `retryable_connection_error`s. https://github.com/rails/rails/blob/ed2bc92b82ddc111150cdf48bb646fd97b3baacb/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L1077 We're already translating `ECONNRESET` (via matching on the error message) and `EPIPE` to `ConnectionFailed`. Rather than adding another case, this commit treats all of the Trilogy `SystemCallError` subclasses as `ConnectionFailed`. This requires bumping trilogy 2.7 so we can get trilogy-libraries/trilogy#143
composerinteralia
added a commit
to composerinteralia/rails
that referenced
this pull request
Jan 23, 2024
At GitHub we get a fair number of Trilogy `ETIMEDOUT` errors (for known reasons that we might be able to improve somewhat, but I doubt we'll make them go away entirely). These are very much retryable network errors, so it'd be handy if these `ETIMEDOUT` errors were translated to `ConnectionFailed` instead of `StatementInvalid`, making them `retryable_connection_error`s. https://github.com/rails/rails/blob/ed2bc92b82ddc111150cdf48bb646fd97b3baacb/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L1077 We're already translating `ECONNRESET` (via matching on the error message) and `EPIPE` to `ConnectionFailed`. Rather than adding another case, this commit treats all of the Trilogy `SystemCallError` subclasses as `ConnectionFailed`. This requires bumping trilogy 2.7 so we can get trilogy-libraries/trilogy#143
viralpraxis
pushed a commit
to viralpraxis/rails
that referenced
this pull request
Mar 24, 2024
At GitHub we get a fair number of Trilogy `ETIMEDOUT` errors (for known reasons that we might be able to improve somewhat, but I doubt we'll make them go away entirely). These are very much retryable network errors, so it'd be handy if these `ETIMEDOUT` errors were translated to `ConnectionFailed` instead of `StatementInvalid`, making them `retryable_connection_error`s. https://github.com/rails/rails/blob/ed2bc92b82ddc111150cdf48bb646fd97b3baacb/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L1077 We're already translating `ECONNRESET` (via matching on the error message) and `EPIPE` to `ConnectionFailed`. Rather than adding another case, this commit treats all of the Trilogy `SystemCallError` subclasses as `ConnectionFailed`. This requires bumping trilogy 2.7 so we can get trilogy-libraries/trilogy#143
fractaledmind
pushed a commit
to fractaledmind/rails
that referenced
this pull request
May 13, 2024
At GitHub we get a fair number of Trilogy `ETIMEDOUT` errors (for known reasons that we might be able to improve somewhat, but I doubt we'll make them go away entirely). These are very much retryable network errors, so it'd be handy if these `ETIMEDOUT` errors were translated to `ConnectionFailed` instead of `StatementInvalid`, making them `retryable_connection_error`s. https://github.com/rails/rails/blob/ed2bc92b82ddc111150cdf48bb646fd97b3baacb/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L1077 We're already translating `ECONNRESET` (via matching on the error message) and `EPIPE` to `ConnectionFailed`. Rather than adding another case, this commit treats all of the Trilogy `SystemCallError` subclasses as `ConnectionFailed`. This requires bumping trilogy 2.7 so we can get trilogy-libraries/trilogy#143
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@composerinteralia and I paired on making another pass over the errors. Partly inspired by complexities revealed in rails/rails#50202
The most significant change is that this redefines
===
on our customSystemCallError
descendants to use the standardModule#===
implementation. Without this they are hard to check for specifically because the Errno classes redefine===
to make anything which responds toerrno
and returns the same one equal. As suggested by @byroot in rails/rails#50202 (comment)This also removes the inheritance of
Trilogy::TimeoutError
fromErrno::ETIMEDOUT
, as that represents a timeout we have declared after waiting rather than an I/O timeout the kernel/stdlib is informing us about.Lastly this deprecates
Trilogy::ConnectionRefusedError
andTrilogy::ConnectionResetError
, replacing them withTrilogy::SyscallError::ECONNREFUSED
andTrilogy::SyscallError::ECONNRESET
(and making them aliases). This avoids having duplicate errors representing the same thing and makes all our "errno" errors share common implementation 😌. As a bonus this removes some C and replaces it with Ruby.I think this makes some good progress in making errors easier to handle, but I do anticipate making at least a "part 3" 😅.
cc @adrianna-chang-shopify @matthewd