Skip to content

Handling exception #29

Answered by Mulkave
cgsauy asked this question in Q&A
Discussion options

You must be logged in to vote

@cgsauy The best way to handle exceptions is the Laravel native way, as long as we're talking about HTTP exceptions that can be thrown at any level in the app and then their handling centralised at the exception handler app/Exceptions/Handler.php. This is best because it is the most anticipated place for us to find them, and that way handling doesn't get lost in the nesting of the logic.

However, if you were to handle certain exceptions to do something upon their occurrence (try/catch) you may then decide depending on the responsibility of the handler. For example if you had the following structure:

  • Feature

    • Operation
      • Job: throws exception
  • If the exception had to be gracefully han…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Mulkave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #28 on September 07, 2021 16:57.