Reputation: 241
I'm looking for any way to handle the QueryException
using the laravel framework.
Is there any possible way to prevent the usual user from getting such an error with a handler?
I tried to prevent that black detailed error page not to be visible to any user.
Upvotes: 0
Views: 972
Reputation: 34688
Catch an exception on using try-catch
statements :
Use Exception;
try
{
// write your codes here
}
catch(\Exception $e)
{
//dd($e->getMessage());
return "Something Went Wrong";
}
If you want to catch PDO Exception
:
use PDOException;
try
{
//write your codes here
}
catch(\PDOException $e)
{
//dd($e->getMessage());
return "Something Went Wrong":
}
Upvotes: 1