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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -