Learner\Exceptions\Handler::handle PHP Method

handle() private method

Convert the Exception into a JSON HTTP Response
private handle ( Request $request, Exception $e ) : JSONResponse
$request Request
$e Exception
return JSONResponse
    private function handle($request, Exception $e)
    {
        if ($e instanceof CribbbException) {
            $data = $e->toArray();
            $status = $e->getStatus();
        }
        if ($e instanceof VideoNotFoundHttpException) {
            $data = array_merge(['id' => 'video_not_found', 'status' => '404'], config('errors.video_not_found'));
            $status = 404;
        }
        return response()->json($data, $status);
    }