クマのブログ

つまづいたところ、学びを書いていきます

例外のカスタム~reportable, renderable~

reportable

https://readouble.com/laravel/8.x/ja/errors.html#the-exception-handler

クロージャ―で処理をしたい時とかに使う

※以下記事の感じ。実際に使ってないけど、例外投げられた時にslackへnotifyする、みたいな

https://tsyama.hatenablog.com/entry/laravel-slack-notification

renderable

https://readouble.com/laravel/8.x/ja/errors.html#rendering-exceptions

  • デフォルトではmessageやstatus code、traceが返されるが、これを変換する場合に使う
    • ex. 作成した例外クラスで404を返したいときとか