Module: Ketchup::Exception

Defined in:
lib/rails/error.rb,
lib/rails/mailer.rb,
lib/util/support.rb,
lib/rails/controller.rb,
lib/exception-ketchup.rb

Defined Under Namespace

Modules: Controller, SupportedMongos Classes: Error, Mailer

Constant Summary collapse

@@sender =
""
@@deliver_mail =
true
@@persist =
true
@@environment =
[:production]
@@recipients =
[]
@@log_error =
lambda do |error|
  Rails::logger.info("!!! CATCH ERROR: #{error.message}")   
  Rails::logger.info(error.backtrace.join("\n")) 
end
@@subject =
""
@@template_path =
""
@@template_name =
"exception"
@@exception_collection =
:errors

Class Method Summary collapse

Class Method Details

.environmentObject



45
46
47
48
49
50
51
# File 'lib/exception-ketchup.rb', line 45

def self.environment
  if @@environment.is_a?(Symbol) or @@environment.is_a?(String)
    return [@@environment]
  else
    return @@environment
  end
end

.recipientsObject

A comma seperated list or an array of email addresses to which the exception notification should be mailed.



62
63
64
65
66
67
68
# File 'lib/exception-ketchup.rb', line 62

def self.recipients
  if @@deliver_mail
    raise "[Ketchup] You have to provide at least one recipient!" if @@recipients.empty?
  end
  return @@recipients.join(",") if @@recipients.respond_to?(:join)
  return @@recipients
end

.senderObject



75
76
77
78
79
80
81
# File 'lib/exception-ketchup.rb', line 75

def self.sender
  if @@deliver_mail
    STDOUT.write "[Ketchup] You have to provide a sender email." if @@sender.empty?
  end
  #return "[email protected]"
  return @@sender
end

.sender=(sender) ⇒ Object

The senders address. Required for configuration



71
72
73
# File 'lib/exception-ketchup.rb', line 71

def self.sender=(sender)
  @@sender = sender
end

.setup {|_self| ... } ⇒ Object

Setup ketchup. The config file should be in config/initializers.

Yields:

  • (_self)

Yield Parameters:



23
24
25
# File 'lib/exception-ketchup.rb', line 23

def self.setup(&block)
  yield(self)
end