Better way of using TryCatch in PHP | Laravel

Krixnaas - May 5 '22 - - Dev Community

Provide you a timestamp, message as well as path

 try{

  // your code 

 } catch (Exception $exception) {
            return Response::json([
                "timestamp" => date('Y-m-d\TH:i:s.vP'),
                "status" => 400,
                "error" => "Bad Request",
                "message" => $exception->getMessage(),
                "path" => \Request::getRequestUri()
            ], 400);
        }
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player