lib/balanced/error.rb in balanced-0.7.2 vs lib/balanced/error.rb in balanced-0.7.4
- old
+ new
@@ -40,11 +40,26 @@
# General error class for non API response exceptions
class StandardError < Error
attr_reader :message
alias :error_message :message
- def initialize(message)
+ # @param [String, nil] message a description of the exception
+ def initialize(message = nil)
@message = message
+ super(message)
+ end
+ end
+
+ # Raised when attempted to create a debit or hold for a card not associated to an account
+ class UnassociatedCardError < StandardError
+ # @param [Balanced::Card] card
+ def initialize(card)
+ @card = card
+ super(error_message)
+ end
+
+ def error_message
+ "The Balanced::Card with uri=#{@card.attributes['uri']} is not associated to an account"
end
end
class MoreInformationRequired < Error
def redirect_uri