Skip to content

Commit

Permalink
Set-up exception notification for production
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Altmann committed Oct 25, 2015
1 parent d6af0b6 commit b5ecf9c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/objects/service/fastbill_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def fastbill_create_customer
customer = Fastbill::Automatic::Customer.create(attributes)
@seller.update_attribute :fastbill_id, customer.customer_id
rescue => e
ExceptionNotifier.notify_exception(e, data: { user: @seller.id })
ExceptionNotifier.notify_exception(e, data: { user: @seller })
end
end
end
Expand Down Expand Up @@ -115,7 +115,7 @@ def fastbill_create_subscription
@bt.send("billed_for_#{ type }=", true)
@bt.save
rescue => e
ExceptionNotifier.notify_exception(e, data: { business_transaction: @bt.id })
ExceptionNotifier.notify_exception(e, data: { business_transaction: @bt, user: @seller })
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,13 @@

# Better logging
config.lograge.enabled = true

# Notify exceptions by email
config.middleware.use ExceptionNotification::Rack,
ignore_crawlers: %w{Googlebot bingbot},
email: {
email_prefix: '[Production] ',
sender_address: %{"Exception notifier" <notifier@fairmondo.de>},
exception_recipients: %w{exceptions@fairmondo.de}
}
end
8 changes: 0 additions & 8 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,4 @@
Rails.application.routes.default_url_options[:host] = 'http://development.fairmondo.de'
#Memcached
config.cache_store = :dalli_store, 'localhost', { :namespace => "fairmondo", :expires_in => 1.day, :compress => true }

config.middleware.use ExceptionNotification::Rack,
ignore_crawlers: %w{Googlebot bingbot},
email: {
email_prefix: '[Staging] ',
sender_address: %{"Exception notifier" <notifier@fairmondo.de>},
exception_recipients: %w{exceptions@fairmondo.de}
}
end

0 comments on commit b5ecf9c

Please sign in to comment.