Sha256: 503b6900bcc9753a88c6463a33c08ad3d41fca8fc235d1d5f1096b028d46227b
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true require 'rubygems' require 'bundler/setup' require 'sinatra/base' require 'exception_notification' class SinatraApp < Sinatra::Base use Rack::Config do |env| # This is highly recommended. It will prevent the ExceptionNotification email from including your users' passwords env['action_dispatch.parameter_filter'] = [:password] 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 StandardError => 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
exception_notification-4.5.0 | examples/sinatra/sinatra_app.rb |
exception_notification-4.4.3 | examples/sinatra/sinatra_app.rb |
exception_notification-4.4.1 | examples/sinatra/sinatra_app.rb |