Skip to content

Instantly share code, notes, and snippets.

@seiyawati
Created November 18, 2023 08:57
Show Gist options
  • Select an option

  • Save seiyawati/ee75ff87998c5957bc8181d148bd3662 to your computer and use it in GitHub Desktop.

Select an option

Save seiyawati/ee75ff87998c5957bc8181d148bd3662 to your computer and use it in GitHub Desktop.
Rails7.0以降の例外処理の書き方
# Railsガイド: Rails アプリケーションのエラー通知
# https://railsguides.jp/error_reporting.html
# 7.0 < ver
begin
do_something
rescue SomethingIsBroken => error
MyErrorReportingService.notify(error)
end
# 7.0 > ver
Rails.error.handle(SomethingIsBroken) do
do_something
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment