Exception: RipeDbClient::Unsupported

Inherits:
Error
  • Object
show all
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.message # => "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_message = "Default error message"
exception.message # => "Default error message"

Author:

  • Mike Simkins

Instance Attribute Summary collapse

Instance Method Summary collapse

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 (message = nil, action = nil, subject = nil)
  @message = message
  @action = action
  @subject = subject
  @default_message = "The feature you require is not currently supported"
end

Instance Attribute Details

#actionObject (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

Parameters:

  • value

    the value to set the attribute default_message to.



69
70
71
# File 'lib/ripe_db_client/exceptions.rb', line 69

def default_message=(value)
  @default_message = value
end

#subjectObject (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_sString

Returns the error message

Returns:

  • (String)

    Returns the error message



79
80
81
# File 'lib/ripe_db_client/exceptions.rb', line 79

def to_s
  @message || @default_message
end