Exception: RipeDbClient::Unsupported
- Defined in:
- lib/ripe_db_client/exceptions.rb
Overview
This error is raised when a user tries to access an unsupported function
raise RipeDbClient::Unsupported.new("my secret feature", "top secret")
The passed message, action, and subject are optional and can later be retrieved when rescuing from the exception.
exception. # => "my secret feature"
exception.action # => "top_secret"
If the message is not specified (or is nil) it will default to “The feature you require is not currently supported” This default can be overridden by setting default_message.
exception. = "Default error message"
exception. # => "Default error message"
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#default_message ⇒ Object
writeonly
Sets the attribute default_message.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
-
#initialize(message = nil, action = nil, subject = nil) ⇒ Unsupported
constructor
A new instance of Unsupported.
-
#to_s ⇒ String
Returns the error message.
Constructor Details
#initialize(message = nil, action = nil, subject = nil) ⇒ Unsupported
Returns a new instance of Unsupported.
71 72 73 74 75 76 |
# File 'lib/ripe_db_client/exceptions.rb', line 71 def initialize ( = nil, action = nil, subject = nil) @message = @action = action @subject = subject @default_message = "The feature you require is not currently supported" end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
68 69 70 |
# File 'lib/ripe_db_client/exceptions.rb', line 68 def action @action end |
#default_message=(value) ⇒ Object (writeonly)
Sets the attribute default_message
69 70 71 |
# File 'lib/ripe_db_client/exceptions.rb', line 69 def (value) @default_message = value end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
68 69 70 |
# File 'lib/ripe_db_client/exceptions.rb', line 68 def subject @subject end |
Instance Method Details
#to_s ⇒ String
Returns the error message
79 80 81 |
# File 'lib/ripe_db_client/exceptions.rb', line 79 def to_s @message || @default_message end |