Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel custom exception handler

// Add this function in Handler.php laravel  

/**
     * Register the exception handling callbacks for the application.
     *
     * @return void
     */
    public function register()
    {
        $this->renderable(function (Exception $e, $request) {
            ErrorLog::addToLog('Exception: ', $e);
            return GlobalApiResponse::getResponse((string) 500, null, $e->getMessage());
        });
    }
 
PREVIOUS NEXT
Tagged: #laravel #custom #exception #handler
ADD COMMENT
Topic
Name
7+8 =