一、安装
通过将其添加到Gemfile中的Rubygems安装SDK:
gem "sentry-raven"
二、配置
Puma提供了一个用于处理低级错误的配置选项。
# in your puma.rb config
lowlevel_error_handler do |ex, env|
Raven.capture_exception(
ex,
:message => ex.message,
:extra => { :puma => env },
:transaction => "Puma"
)
# note the below is just a Rack response
[500, {}, ["An error has occurred, and engineers have been informed. Please reload the page. If you continue to have problems, contact support@example.com\n"]]
end