Created
November 18, 2023 08:57
-
-
Save seiyawati/ee75ff87998c5957bc8181d148bd3662 to your computer and use it in GitHub Desktop.
Rails7.0以降の例外処理の書き方
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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