File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
lib/async/container/supervisor Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -251,6 +251,7 @@ def write(**message)
251251 #
252252 # @parameter timeout [Numeric, nil] Optional timeout for the call.
253253 # @parameter message [Hash] The call message.
254+ # @raises [IOError | Errno::EPIPE | Errno::ECONNRESET] If the write fails.
254255 # @returns [Hash] The response.
255256 def call ( timeout : nil , **message )
256257 id = next_id
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def dispatch(call)
2121 let ( :connection ) { Async ::Container ::Supervisor ::Connection . new ( stream ) }
2222
2323 with "dispatch" do
24- it "handles failed writes" do
24+ it "handles failed writes when dispatching a call " do
2525 stream . write ( JSON . dump ( { id : 1 , do : :test } ) << "\n " )
2626 stream . rewind
2727
@@ -39,6 +39,16 @@ def dispatch(call)
3939
4040 expect ( connection . calls ) . to be ( :empty? )
4141 end
42+
43+ it "handles failed writes when making a call" do
44+ expect ( stream ) . to receive ( :write ) . and_raise ( IOError , "Test error" )
45+
46+ expect do
47+ connection . call ( do : :test )
48+ end . to raise_exception ( IOError , message : be =~ /Test error/ )
49+
50+ expect ( connection . calls ) . to be ( :empty? )
51+ end
4252 end
4353
4454 with subject ::Call do
You can’t perform that action at this time.
0 commit comments