renyan
237
2
General

Catch statements are ignored, exception is handled in global handler

Posted 3 years ago by renyan

Hello,

    try {
            $this->repository->approve($token, $user);
        } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
            return $this->error('The entry was not found.');
        } catch (Fusion\GAM\ProxyBlock\Exceptions\BlockAlreadyApprovedException $e) {   
            return $this->error('Already approved.');
        } 

The "approve" method just throws these exceptions.

Instead of the local catch statements taking precedence only the global Handler.php is executed.

Why is this happening?

Please sign in or create an account to participate in this conversation.