Learner\Exceptions\Handler::render PHP Method

render() public method

Render an exception into an HTTP response.
public render ( Illuminate\Http\Request $request, Exception $e ) : Illuminate\Http\Response
$request Illuminate\Http\Request
$e Exception
return Illuminate\Http\Response
    public function render($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);
        }
        return parent::render($request, $e);
    }