Laravel Throwable not handle exception - get 500 internal error

64 views Asked by At

In Laravel I have the following controller and method:

public function uploadattachment(Request $request)    
{
    
    try {
        $aa = 3/0;
    }
    catch (Throwable $t) {
      
        return response()->json([
            'status' => 'Error', 
            'message' => $t->getMessage()
        ]);
    }
}

500 internal server error

When I call above method from Angular I get error 500 internal server error. I thought that I will receive 200 and exception will be handled in catch clause in message property


Throwable is under Exception. If dividing by zero is handled by Exception it should be by Throwable as well: division by zero

0

There are 0 answers