Permalink
Browse files

Add docs for the exception classes.

  • Loading branch information...
1 parent b4e4104 commit e5a1a8d9e6133c88e0ffb95cd5cc479d871504ad @alloy alloy committed Aug 6, 2010
Showing with 27 additions and 12 deletions.
  1. +27 −12 lib/mollie/sms.rb
View
39 lib/mollie/sms.rb
@@ -19,19 +19,34 @@ class SMS
'landline' => '8'
}
- class StandardError < ::StandardError; end
- class ValidationError < StandardError; end
- class MissingRequiredParam < StandardError; end
-
- class DeliveryFailure < StandardError
- attr_reader :sms, :response
-
- def initialize(sms, response)
- @sms, @response = sms, response
- end
+ # A collection of exception classes raised by Mollie::SMS.
+ module Exceptions
+ # The base class for Mollie::SMS exceptions.
+ class StandardError < ::StandardError; end
+
+ # The exception class which is used to indicate a validation error of one
+ # of the {SMS#params parameters} that would be send to the gateway.
+ class ValidationError < StandardError; end
+
+ # The exception class which is used to indicate a delivery failure, when
+ # the {SMS#deliver!} method is used and delivery fails.
+ class DeliveryFailure < StandardError
+ # @return [SMS] The Mollie::SMS instance.
+ attr_reader :sms
+
+ # @return [Response] The Mollie::SMS::Response instance.
+ attr_reader :response
+
+ # @param [SMS] sms The Mollie::SMS instance.
+ # @param [Response] response The Mollie::SMS::Response instance.
+ def initialize(sms, response)
+ @sms, @response = sms, response
+ end
- def message
- "(#{@response.message}) #{@sms.to_s}"
+ # @return [String] A string representation of the exception.
+ def message
+ "(#{@response.message}) #{@sms.to_s}"
+ end
end
end

0 comments on commit e5a1a8d

Please sign in to comment.