@@ -473,13 +473,41 @@ class DecryptResponse
473473 expect { command . execute ( client ) } . to raise_error ( Google ::Apis ::TransmissionError )
474474 end
475475
476+ it 'should raise transmission error instead of connection reset' do
477+ stub_request ( :get , 'https://www.googleapis.com/zoo/animals' ) . to_raise ( HTTPClient ::KeepAliveDisconnected )
478+ command = Google ::Apis ::Core ::HttpCommand . new ( :get , 'https://www.googleapis.com/zoo/animals' )
479+ command . options . retries = 0
480+ expect { command . execute ( client ) } . to raise_error ( Google ::Apis ::TransmissionError )
481+ end
482+
483+ it 'should raise transmission error instead of connection timeout' do
484+ stub_request ( :get , 'https://www.googleapis.com/zoo/animals' ) . to_raise ( Errno ::ETIMEDOUT )
485+ command = Google ::Apis ::Core ::HttpCommand . new ( :get , 'https://www.googleapis.com/zoo/animals' )
486+ command . options . retries = 0
487+ expect { command . execute ( client ) } . to raise_error ( Google ::Apis ::TransmissionError )
488+ end
489+
490+ it 'should raise transmission error instead of connection refused' do
491+ stub_request ( :get , 'https://www.googleapis.com/zoo/animals' ) . to_raise ( Errno ::ECONNREFUSED )
492+ command = Google ::Apis ::Core ::HttpCommand . new ( :get , 'https://www.googleapis.com/zoo/animals' )
493+ command . options . retries = 0
494+ expect { command . execute ( client ) } . to raise_error ( Google ::Apis ::TransmissionError )
495+ end
496+
476497 it 'should raise rate limit error for 429 status codes' do
477498 stub_request ( :get , 'https://www.googleapis.com/zoo/animals' ) . to_return ( status : [ 429 , '' ] )
478499 command = Google ::Apis ::Core ::HttpCommand . new ( :get , 'https://www.googleapis.com/zoo/animals' )
479500 command . options . retries = 0
480501 expect { command . execute ( client ) } . to raise_error ( Google ::Apis ::RateLimitError )
481502 end
482503
504+ it 'should raise request timeout error for 408 status codes' do
505+ stub_request ( :get , 'https://www.googleapis.com/zoo/animals' ) . to_return ( status : [ 408 , '' ] )
506+ command = Google ::Apis ::Core ::HttpCommand . new ( :get , 'https://www.googleapis.com/zoo/animals' )
507+ command . options . retries = 0
508+ expect { command . execute ( client ) } . to raise_error ( Google ::Apis ::RequestTimeOutError )
509+ end
510+
483511 it 'should not normalize unicode values by default' do
484512 stub_request ( :get , 'https://www.googleapis.com/Cafe%CC%81' ) . to_return ( status : [ 200 , '' ] )
485513 template = Addressable ::Template . new ( 'https://www.googleapis.com/{path}' )
0 commit comments