lundi 25 juillet 2016

Laravel exceptions handler best practice

I'm working on a project with laravel, exceptions are getting catched in the Exceptions\Handler.php inside the render function like so:

public function render($request, Exception $e){
      switch(get_class($e)){
              case SOME_EXCEPTION::class:
                    do something..
              ...
              ...
              default:
                    do something..
     }

The problem as you can see it's getting ugly and messy code with lot of cases

What is the best practice to avoid this situation?

Can you give an example how to solve this out?

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire