Skip to content

Commit 46fa0c5

Browse files
Introduce remote error
1 parent 8f597ae commit 46fa0c5

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

lib/protocol/http/error.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ class Error < StandardError
1414
class RefusedError < Error
1515
end
1616

17+
# Raised when the remote endpoint fails while processing an HTTP stream or request.
18+
# This error does not indicate whether application processing occurred. Where available, the protocol-specific error should be attached as the cause.
19+
class RemoteError < Error
20+
end
21+
1722
# @deprecated Use {RefusedError} instead.
1823
RequestRefusedError = RefusedError
1924

releases.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Releases
22

3+
## Unreleased
4+
5+
- Introduce `Protocol::HTTP::RemoteError` for remote endpoint failures where application processing may have occurred.
6+
37
## v0.65.0
48

59
- Improve `Accept` header parsing for quoted pairs, malformed parameters, invalid wildcards, and invalid quality factors.

test/protocol/http/error.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@
2323
end
2424
end
2525

26+
describe Protocol::HTTP::RemoteError do
27+
let(:error) {subject.new("Remote endpoint encountered an internal error.")}
28+
29+
with "#initialize" do
30+
it "is an HTTP error" do
31+
expect(error).to be_a(Protocol::HTTP::Error)
32+
end
33+
34+
it "has a descriptive message" do
35+
expect(error.message).to be == "Remote endpoint encountered an internal error."
36+
end
37+
end
38+
end
39+
2640
describe Protocol::HTTP::DuplicateHeaderError do
2741
let(:key) {"content-length"}
2842
let(:existing_value) {"100"}

0 commit comments

Comments
 (0)