-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#41 added a translation of `ECONNREFUSED` and `ECONNRESET` to `Trilogy::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 trilogy-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 for `Errno::ETIMEDOUT`. This keeps Trilogy compatible with GitHub's existing rescues, while still raising something that is a `Trilogy::Error` and a `Trilogy::ConnectionError` (although NOT a `Trilogy::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 single `Trilogy::SystemCallError` that inherits from `SystemCallError` and then keeps a reference to the underlying `Errno` error.
- Loading branch information
1 parent
0776fcf
commit a6b3765
Showing
3 changed files
with
34 additions
and
22 deletions.
There are no files selected for viewing
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
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
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