lib/balanced/error.rb in balanced-1.0 vs lib/balanced/error.rb in balanced-1.0.1
- old
+ new
@@ -3,12 +3,14 @@
# Custom error class for rescuing from all API response-related Balanced errors
class Error < ::StandardError
attr_reader :response
# @param [Hash] response the decoded json response body
- def initialize(response)
+ def initialize(response=nil)
@response = response
- super error_message
+ unless response.nil?
+ super error_message
+ end
end
# @return [Hash]
def body
@body ||= begin