app/Exceptions/Handler.php
protected function renderXmlHttpException($e)
    {
        // handle our ajax errors
        $data = [
            'message' => $e->getMessage(),
        ];

        if ($e instanceof HttpException) {
            return new JsonResponse($data, $e->getStatusCode());
        }

        return new JsonResponse($data, 500);
    }
protected function renderXmlHttpException($e)
    {
        // handle our ajax errors
        $data = [
            'message' => $e->getMessage(),
        ];

        if ($e instanceof HttpException) {
            return new JsonResponse($data, $e->getStatusCode());
        }

        return new JsonResponse($data, 500);
    }
protected function renderXmlHttpException ( $ e ) { // handle our ajax errors $ data = [ 'message' => $ e -> getMessage ( ) , ] ; if ( $ e instanceof HttpException ) { return new JsonResponse ( $ data , $ e -> getStatusCode ( ) ) ; } return new JsonResponse ( $ data , 500 ) ; }
Renders an exception from ajax requests.

@param \Exception $e

@return JsonResponse
Renders an exception from ajax requests .