Gem for applications to automatically post errors to the Hoptoad of their choice.
| API_VERSION | = | "2.0" |
| LOG_PREFIX | = | "** [Hoptoad] " |
| HEADERS | = | { 'Content-type' => 'text/xml', 'Accept' => 'text/xml, application/xml' |
| VERSION | = | "2.4.11".freeze |
| IGNORE_DEFAULT | = | ['ActiveRecord::RecordNotFound', 'ActionController::RoutingError', 'ActionController::InvalidAuthenticityToken', 'CGI::Session::CookieStore::TamperedWithCookie', 'ActionController::UnknownAction', 'AbstractController::ActionNotFound'] |
| secure | -> | secure? |
| configuration | [RW] | A Hoptoad configuration object. Must act like a hash and return sensible values for all Hoptoad configuration options. See HoptoadNotifier::Configuration. |
| sender | [RW] | The sender object is responsible for delivering formatted data to the Hoptoad server. Must respond to send_to_hoptoad. See HoptoadNotifier::Sender. |
Call this method to modify defaults in your initializers.
@example
HoptoadNotifier.configure do |config|
config.api_key = '1234567890abcdef'
config.secure = false
end
Sends an exception manually using this method, even when you are not in a controller.
@param [Exception] exception The exception you want to notify Hoptoad about. @param [Hash] opts Data that will be sent to Hoptoad.
@option opts [String] :api_key The API key for this project. The API key is a unique identifier that Hoptoad uses for identification. @option opts [String] :error_message The error returned by the exception (or the message you want to log). @option opts [String] :backtrace A backtrace, usually obtained with caller. @option opts [String] :request The controller‘s request object. @option opts [String] :session The contents of the user‘s session. @option opts [String] :environment ENV merged with the contents of the request‘s environment.
Sends the notice unless it is one of the default ignored exceptions @see HoptoadNotifier.notify
Takes a block and adds it to the list of backtrace filters. When the filters run, the block will be handed each line of the backtrace and can modify it as necessary.
@example
config.filter_bracktrace do |line|
line.gsub(/^#{Rails.root}/, "[RAILS_ROOT]")
end
@param [Proc] block The new backtrace filter. @yieldparam [String] line A line in the backtrace.
Takes a block and adds it to the list of ignore filters. When the filters run, the block will be handed the exception. @example
config.ignore_by_filter do |exception_data|
true if exception_data[:error_class] == "RuntimeError"
end
@param [Proc] block The new ignore filter @yieldparam [Hash] data The exception data given to +HoptoadNotifier.notify+ @yieldreturn [Boolean] If the block returns true the exception will be ignored, otherwise it will be processed by hoptoad.
Overrides the list of default ignored errors.
@param [Array<Exception>] names A list of exceptions to ignore.
Overrides the list of default ignored user agents
@param [Array<String>] A list of user agents to ignore
Returns a hash of all configurable options merged with hash
@param [Hash] hash A set of configuration options that will take precedence over the defaults