Raise ActiveResource::ConnectionRefusedError on Errno::ECONNREFUSED
What
Raises a custom ActiveResource::ConnectionError when failing to connect to an external endpoint completely, changing something like:
Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:4568 (Connection refused - connect(2) for "127.0.0.1" port 4568)
...into:
ActiveResource::ConnectionRefusedError: Failed to open TCP connection to 127.0.0.1:4568 (Connection refused - connect(2) for "127.0.0.1" port 4568)
Why
Follows the convention of rescuing network errors and wrapping them in ActiveResource custom errors, allowing them to be rescued without leaking knowledge of internals.
This is a behavior change. If people are already rescuing ECONNREFUSED they would now get error in production. Can we do it without breaking existing code?
Cheers, good shout @rafaelfranca!
The only thing that immediately comes to mind is having the custom exception inherit from ECONNREFUSED rather than ConnectionError.
The lack of parity with the other custom exceptions feels a little off, but it might be worth it to avoid a breaking change? Am I otherwise missing something? 🤔