lib/cryptomus/errors.rb in cryptomus-0.2.0 vs lib/cryptomus/errors.rb in cryptomus-0.2.1
- old
+ new
@@ -15,10 +15,11 @@
# @param msg [String,nil]
def initialize(response, msg = nil)
@response = response
@status = response&.status
@response_body = response&.body
- msg ||= "Response #{status}, #{response_body}" if response
+ body_msg = response_body.is_a?(Hash) ? JSON.generate(response_body) : response_body
+ msg ||= "Response #{status}, #{body_msg}" if response
super(msg || self.class.name)
end
end
end
end