public function jsonResponse(Exception $exception)
    {
        $this->exception = $exception;
        $this->jsonApiResponse = new JsonApiResponse;

        if ($this->exceptionIsTreated()) {
            $this->callExceptionHandler();
        } else {
            $this->setDefaultResponse();
        }

        return response()->json(
            $this->jsonApiResponse->toArray(),
            $this->jsonApiResponse->getStatus()
        );
    }
public function jsonResponse(Exception $exception)
    {
        $this->exception = $exception;
        $this->jsonApiResponse = new JsonApiResponse;

        if ($this->exceptionIsTreated()) {
            $this->callExceptionHandler();
        } else {
            $this->setDefaultResponse();
        }

        return response()->json(
            $this->jsonApiResponse->toArray(),
            $this->jsonApiResponse->getStatus()
        );
    }
public function jsonResponse ( Exception $ exception ) { $ this -> exception = $ exception ; $ this -> jsonApiResponse = new JsonApiResponse ; if ( $ this -> exceptionIsTreated ( ) ) { $ this -> callExceptionHandler ( ) ; } else { $ this -> setDefaultResponse ( ) ; } return response ( ) -> json ( $ this -> jsonApiResponse -> toArray ( ) , $ this -> jsonApiResponse -> getStatus ( ) ) ; }
Handle the json response. Check if exception is treated. If true call
the specific handler. If false set the default response to be returned.

@param  Exception $exception
@return JsonResponse
Handle the json response . Check if exception is treated . If true call the specific handler . If false set the default response to be returned .