Exception: PostDB::MailLocationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/postdb/errors/mail_location.rb

Overview

The MailLocationError error is used by the MailLocation class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(suberror = nil, *args) ⇒ MailLocationError

Example:

>> raise PostDB::MailLocationError.new
=> #<PostDB::MailLocationError:0x00000000000000>


23
24
25
26
27
28
29
# File 'lib/postdb/errors/mail_location.rb', line 23

def initialize(suberror = nil, *args)
  # Store the suberror property (if provided)
  @suberror = suberror if suberror

   # Store the arguments
   @arguments = args
end

Instance Attribute Details

#argumentsObject (readonly)

An array containing additional arguments



11
12
13
# File 'lib/postdb/errors/mail_location.rb', line 11

def arguments
  @arguments
end

#attributeObject (readonly)

A suberror to describe the error in more detail



7
8
9
# File 'lib/postdb/errors/mail_location.rb', line 7

def attribute
  @attribute
end

Instance Method Details

#to_sObject

Convert the error to a string

Example:

>> error.to_s
=> "Error Description"


37
38
39
40
41
42
43
44
# File 'lib/postdb/errors/mail_location.rb', line 37

def to_s
  case @suberror
  when :malformed_location
    "'#{@arguments[0]}' is not a valid location."
  else
    super.to_s
  end
end