activeresource
activeresource copied to clipboard
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.