I want a custom message to be displayed to the user when I raise an error in Laravel 5.1. For example, in the controller, I could:
if(!has_access()){ abort('401', 'please contact support to gain access to this item.'); }
Then my custom error page, I would display the error with:
$exception->getMessage();
However, what if there was an SQL error or other event? Wouldn't that also set up an Exceptional message that I would unknowingly display on my page with an error?
The PHP docs for getMessage () do not contain details about this.
How can I set a specific exception message without security risk?
source share