I am in need of having try-catch blocks inside my business logic. Thereby I can do some logging of the error with some more context.
try {
// business logic
} catch(Exception $e) {
// Log message like 'Could not create user with email something@domain.com'
$msgForUser = CustomErrorHandler::handleError($e, $data->email);
// Display message like 'Your user was not created bla bla bla'
return $msgForUser;
}
I realise I could setup custom error handling in App::error
in start/global.php
, however this removes the opportunity of including variables and messages specific to that function.
The problem is that now my try blocks catches errors in development. And I would like to still get the Whoops exception debugger in development mode. Is this possible?