Exception: PostDB::SetupError

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

Overview

The SetupError error is used when a setup error occurs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Example:

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


23
24
25
26
27
28
29
# File 'lib/postdb/errors/setup.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/setup.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/setup.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/postdb/errors/setup.rb', line 37

def to_s
  case @suberror
  when :invalid_adapter
    "The adapter '#{@arguments[0]}' is not valid."
  when :missing_database_args
    "You must provide the database configuration."
  when :missing_mail_args
    "You must provide the mail configuration."
  when :missing_dkim_args
    "You must provide the DKIM configuration."
  when :missing_mail_location
    "You must provide the mail location string."
  when :missing_dkim_directory
    "You must provide the path to the DKIM keys directory."
  when :missing_trusted_hosts_path
    "You must provide the path to the DKIM TrustedHosts file."
  when :missing_key_table_path
    "You must provide the path to the DKIM KeyTable file."
  when :missing_signing_table_path
    "You must provide the path to the DKIM SigningTable file."
  else
    super.to_s
  end
end