Exception: RipeDbClient::BadParameter
- Defined in:
- lib/ripe_db_client/exceptions.rb
Overview
This error is raised when a user has not specified a value for a mandatory parameter
raise RipeDbClient::BadParameter.new("search parameter missing", "dblookup")
The passed message, action, and subject are optional and can later be retrieved when rescuing from the exception.
exception. # => "search parameter missing"
exception.action # => "dblookup"
If the message is not specified (or is nil) it will default to “You have an Invalid or Missing Parameter” 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) ⇒ BadParameter
constructor
A new instance of BadParameter.
-
#to_s ⇒ String
Returns the error message.
Constructor Details
#initialize(message = nil, action = nil, subject = nil) ⇒ BadParameter
35 36 37 38 39 40 |
# File 'lib/ripe_db_client/exceptions.rb', line 35 def initialize ( = nil, action = nil, subject = nil) = @action = action @subject = subject = "You have an Invalid or Missing Parameter" end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
32 33 34 |
# File 'lib/ripe_db_client/exceptions.rb', line 32 def action @action end |
#default_message=(value) ⇒ Object (writeonly)
Sets the attribute default_message
33 34 35 |
# File 'lib/ripe_db_client/exceptions.rb', line 33 def (value) = value end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
32 33 34 |
# File 'lib/ripe_db_client/exceptions.rb', line 32 def subject @subject end |
Instance Method Details
#to_s ⇒ String
44 45 46 |
# File 'lib/ripe_db_client/exceptions.rb', line 44 def to_s || end |