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.
#41 added a translation of
ECONNREFUSED
andECONNRESET
toTrilogy::BaseConnectionError
.We've got a few places at GitHub where we explicitly rescue these errors (or
SystemCallError
). Although it is possible to rework those rescues to check for particular error messages (like we did intrilogy-libraries/activerecord-trilogy-adapter@03c1610), it'd be a bit easier if we could maintain compatibility. I also worry that checking for specific error messages could be a bit brittle.
This commit introduces two new Trilogy errors, which inherit from the corresponding
Errno
errors. We've already done something like this forErrno::ETIMEDOUT
.This keeps Trilogy compatible with GitHub's existing rescues, while still raising something that is a
Trilogy::Error
and aTrilogy::ConnectionError
(although NOT aTrilogy::BaseConnectionError
anymore).A downside to this approach is that we might end up with a lot of Trilogy-specific
Errno
subclasses. If that gets annoying perhaps we could revisit when it comes time for a major release. Another approach might be a singleTrilogy::SystemCallError
that inherits fromSystemCallError
and then keeps a reference to the underlyingErrno
error.cc @adrianna-chang-shopify