diff --git a/lib/protocol/http/error.rb b/lib/protocol/http/error.rb index 3be3a56..69dc2c6 100644 --- a/lib/protocol/http/error.rb +++ b/lib/protocol/http/error.rb @@ -14,6 +14,11 @@ class Error < StandardError class RefusedError < Error end + # Raised when the remote endpoint fails while processing an HTTP stream or request. + # This error does not indicate whether application processing occurred. Where available, the protocol-specific error should be attached as the cause. + class RemoteError < Error + end + # @deprecated Use {RefusedError} instead. RequestRefusedError = RefusedError diff --git a/releases.md b/releases.md index c161c68..b210d65 100644 --- a/releases.md +++ b/releases.md @@ -1,5 +1,9 @@ # Releases +## Unreleased + + - Introduce `Protocol::HTTP::RemoteError` for remote endpoint failures where application processing may have occurred. + ## v0.65.0 - Improve `Accept` header parsing for quoted pairs, malformed parameters, invalid wildcards, and invalid quality factors. diff --git a/test/protocol/http/error.rb b/test/protocol/http/error.rb index 03ec20d..f4bcd19 100644 --- a/test/protocol/http/error.rb +++ b/test/protocol/http/error.rb @@ -23,6 +23,20 @@ end end +describe Protocol::HTTP::RemoteError do + let(:error) {subject.new("Remote endpoint encountered an internal error.")} + + with "#initialize" do + it "is an HTTP error" do + expect(error).to be_a(Protocol::HTTP::Error) + end + + it "has a descriptive message" do + expect(error.message).to be == "Remote endpoint encountered an internal error." + end + end +end + describe Protocol::HTTP::DuplicateHeaderError do let(:key) {"content-length"} let(:existing_value) {"100"}