Sha256: ff1f791b46ae5cf0920696e28ec2d93e55cbc2693d3924a97b4326df6bbb43a6

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

require 'rubygems'
require 'bundler/setup'
require 'sinatra/base'
require 'exception_notification'

class SinatraApp < Sinatra::Base
  use Rack::Config do |env|
    env["action_dispatch.parameter_filter"] = [:password] # This is highly recommended.  It will prevent the ExceptionNotification email from including your users' passwords
  end

  use ExceptionNotification::Rack,
    :email => {
      :email_prefix => "[Example] ",
      :sender_address => %{"notifier" <notifier@example.com>},
      :exception_recipients => %w{exceptions@example.com},
      :smtp_settings => { :address => "localhost", :port => 1025 }
    }

  get '/' do
    raise StandardError, "ERROR: #{params[:error]}" unless params[:error].blank?
    'Everything is fine! Now, lets break things clicking <a href="/?error=ops"> here </a>. Dont forget to see the emails at <a href="http://localhost:1080">mailcatcher</a> !'
  end

  get '/background_notification' do
    begin
      1/0
    rescue Exception => e
      ExceptionNotifier.notify_exception(e, :data => {:msg => "Cannot divide by zero!"})
    end
    'Check email at <a href="http://localhost:1080">mailcatcher</a>.'
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
exception_notification-4.3.0 examples/sinatra/sinatra_app.rb
exception_notification-4.2.2 examples/sinatra/sinatra_app.rb
exception_notification-4.2.1 examples/sinatra/sinatra_app.rb
exception_notification-4.2.0 examples/sinatra/sinatra_app.rb
exception_notification-4.2.0.rc1 examples/sinatra/sinatra_app.rb
exception_notification_more_info-1.0.1 examples/sinatra/sinatra_app.rb
exception_notification_more_info-1.0.0 examples/sinatra/sinatra_app.rb
exception_notification-4.1.4 examples/sinatra/sinatra_app.rb
exception_notification-4.1.3 examples/sinatra/sinatra_app.rb
exception_notification-4.1.2 examples/sinatra/sinatra_app.rb
exception_notification-4.1.1 examples/sinatra/sinatra_app.rb
exception_notification-4.1.0 examples/sinatra/sinatra_app.rb
exception_notification-4.1.0.rc2 examples/sinatra/sinatra_app.rb