When the app.debug flag is set to false, SQL errors in the filtering code are causing a popup for the end-user with the exception (in this case, the SQL error).
Per the config/datatables.php file, I can control this behaviour pretty easily:
/**
* User friendly message to be displayed on user if error occurs.
* Possible values:
* null - The exception message will be used on error response.
* 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed.
* 'custom message' - Any friendly message to be displayed to the user. You can also use translation key.
*/
'error' => env('DATATABLES_ERROR', null),
I would suggest changing the behaviour if the settings is left null: when app.debug = false, default to a custom message instead of exposing the exception to an end-user. This would be more consistent with how the rest of the framework behaves.
I can take a stab at a PR if you concur that this is a good idea.
System details
Laravel 5.5.28, PHP 7.1.8, and Laravel-Datatables 1.0.0
Summary of problem or feature request
When the app.debug flag is set to false, SQL errors in the filtering code are causing a popup for the end-user with the exception (in this case, the SQL error).
Per the
config/datatables.php
file, I can control this behaviour pretty easily:I would suggest changing the behaviour if the settings is left
null
: whenapp.debug = false
, default to a custom message instead of exposing the exception to an end-user. This would be more consistent with how the rest of the framework behaves.I can take a stab at a PR if you concur that this is a good idea.
System details
Laravel 5.5.28, PHP 7.1.8, and Laravel-Datatables 1.0.0