php - How to catch exception in controller in Laravel? -
in controller need test custom database connection , if it's bad return error. problem catch
block doesn't work... exception message globally defined in app/start/global.php
.
try { db::connection('test'); } catch (exception $e) { dd('error'); }
laravel handles exceptions, no need try/catch. can write custom exception inside \app\exceptions , customise contents of app\exceptions\handler.php format response of individual exception meet needs.
Comments
Post a Comment