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

Ensure syscall error subclasses have an error_code attribute #59

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

adrianna-chang-shopify
Copy link
Collaborator

#53 ensured backwards compatibility for error classes by maintaining ConnectionRefusedError and ConnectionResetError as subclasses of their original syscall errors (ECONNREFUSED and ECONNRESET respectively). However, this meant no longer init'ing these errors with the appropriate error_code, which happens in BaseError right now:
https://github.com/github/trilogy/blob/80c1a55207ed87adb93c4798f0d11ca195a827a1/contrib/ruby/lib/trilogy.rb#L18-L24

This PR ensures these two errors are initialized with the error_code attribute set. Without it, we'll see failures when the Trilogy adapter calls #error_code.

There's some duplication between the various error classes that still inherit from syscall errors (although I did move the attr_reader up to the Trilogy::Error module), but I'd like to get all of this cleaned up in #58 anyways, so it should be fairly temporary.

cc @composerinteralia if this looks okay to you I'll merge! 😄

@adrianna-chang-shopify adrianna-chang-shopify merged commit bd92053 into main Mar 16, 2023
@adrianna-chang-shopify adrianna-chang-shopify deleted the ac-error-codes-to-syscall-errors branch March 16, 2023 13:47
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.

2 participants