File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
lib/slack/web/faraday/response Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,11 @@ def raise_if_too_many_requests!(env)
1111 def raise_if_response_is_invalid_json! ( env )
1212 return if response_content_type_is_a_string? ( env ) || env . body . is_a? ( Hash )
1313
14- raise ::Faraday ::ParsingError . new ( nil , env . response )
14+ begin
15+ raise JSON ::ParserError
16+ rescue StandardError => e
17+ raise ::Faraday ::ParsingError . new ( e , env . response )
18+ end
1519 end
1620
1721 def response_content_type_is_a_string? ( env )
Original file line number Diff line number Diff line change 295295 expect { request } . to raise_error ( Slack ::Web ::Api ::Errors ::ParsingError ) . with_message ( 'parsing_error' )
296296 expect ( exception . response . body ) . to eq ( '<html></html>' )
297297 expect ( exception . cause ) . to be_a ( Faraday ::ParsingError )
298+ expect ( exception . cause . cause ) . to be_a ( JSON ::ParserError )
298299 end
299300 end
300301
305306 expect { request } . to raise_error ( Slack ::Web ::Api ::Errors ::ParsingError ) . with_message ( 'parsing_error' )
306307 expect ( exception . response . body ) . to eq ( '{' )
307308 expect ( exception . cause ) . to be_a ( Faraday ::ParsingError )
309+ expect ( exception . cause . cause ) . to be_a ( JSON ::ParserError )
308310 end
309311 end
310312 end
You can’t perform that action at this time.
0 commit comments