activeresource icon indicating copy to clipboard operation
activeresource copied to clipboard

Raise ActiveResource::ConnectionRefusedError on Errno::ECONNREFUSED

Open balvig opened this issue 1 year ago • 2 comments

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.

balvig avatar Dec 12 '23 01:12 balvig