Flugg\Responder\Traits\HandlesApiErrors::transformEloquentException PHP Method

transformEloquentException() protected method

Transform an Eloquent exception into an API exception.
protected transformEloquentException ( Exception $exception ) : void
$exception Exception
return void
    protected function transformEloquentException(Exception $exception)
    {
        if ($exception instanceof ModelNotFoundException) {
            throw new ResourceNotFoundException();
        }
        if ($exception instanceof RelationNotFoundException) {
            throw new RelationNotFoundException();
        }
    }