flexisip-account-manager/flexiapi/app/Exceptions/Handler.php
Timothée Jaussoin b1d58d83c9 Fix #177
Implement XMLRPC like retrocompatibility endpoints
Validate phone-info endpoint phone format
Improve OVHSMS error handling and log errors
Complete tests
Fix #34 return a generic message for 404 errors
Fix #38 simplify the domain resolving parameter and remove the domain parameter in the token based account creation endpoint
2022-08-23 11:27:35 +02:00

33 lines
773 B
PHP

<?php
namespace App\Exceptions;
use Throwable;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
protected $dontReport = [
//
];
protected $dontFlash = [
'password',
'password_confirmation',
];
public function report(Throwable $exception)
{
parent::report($exception);
}
public function render($request, Throwable $exception)
{
if ($exception instanceof ModelNotFoundException && $request->wantsJson()) {
return response()->json(['message' => 'Missing elements to perform the request'], 404);
}
return parent::render($request, $exception);
}
}