Exception: MailRU::API::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- MailRU::API::Error
- Defined in:
- lib/mailru-api/error.rb
Direct Known Subclasses
AccessToObjectDeniedError, ApplicationIsNotInstalledError, ApplicationLookupFailedError, AuthorizationFailedError, IncorrectImageError, IncorrectSignatureError, InvalidParameterError, MethodIsDeprecatedError, PermissionDeniedError, UnknownError, UnknownMethodCalledError
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#description ⇒ Object
Returns the value of attribute description.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, description) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(code, description) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 13 |
# File 'lib/mailru-api/error.rb', line 8 def initialize code, description super("#{code}, #{description}") @code = Integer(code) @description = description end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
6 7 8 |
# File 'lib/mailru-api/error.rb', line 6 def code @code end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/mailru-api/error.rb', line 6 def description @description end |
Class Method Details
.create(code, description) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mailru-api/error.rb', line 15 def self.create(code, description) case code when 1 then UnknownError.new(code, description) when 2 then UnknownMethodCalledError.new(code, description) when 3 then MethodIsDeprecatedError.new(code, description) when 100 then InvalidParameterError.new(code, description) when 102 then AuthorizationFailedError.new(code, description) when 103 then ApplicationLookupFailedError.new(code, description) when 104 then IncorrectSignatureError.new(code, description) when 105 then ApplicationIsNotInstalledError.new(code, description) when 200 then PermissionDeniedError.new(code, description) when 202 then AccessToObjectDeniedError.new(code, description) when 501 then IncorrectImageError.new(code, description) else Error.new(code, "Internal Error: #{description}") end end |