class Dogcatcher::Notice
Constants
- MAX_MESSAGE_SIZE
Attributes
action[RW]
Name of the action that caused the exception
exception[R]
The exception itself
metadata[RW]
Additional information about the exception
notifier[RW]
Name of the source that caught the exception
Public Class Methods
new(config, exception)
click to toggle source
@param [Dogcatcher::Config] config @param [Exception] exception
# File lib/dogcatcher/notice.rb, line 19 def initialize(config, exception) @config = config @exception = exception @metadata = {} end
Public Instance Methods
message()
click to toggle source
Markdown-formatted message containing the backtrace and metadata.
@return [String]
# File lib/dogcatcher/notice.rb, line 28 def message backtrace = @config.backtrace_cleaner.clean(exception.backtrace) markdown = Markdown.new metadata.each { |key, value| markdown.bullet("#{key}: #{value}") } max_block_size = MAX_MESSAGE_SIZE - markdown.result.length - 10 markdown.code_block(backtrace.join("\n"), 'text', max_block_size) markdown.result end
title()
click to toggle source
Title of the event/notice.
Includes the program name if a program name is configured.
@return [String]
# File lib/dogcatcher/notice.rb, line 58 def title program = "#{@config.program} - " if @config.program "#{program}#{exception.class}:#{exception.message}" end