在流明中,我想为任何异常添加自定义响应

I added custom response into render method of handler.php like this:

public function render($request, Exception $e)
{

    //$e->getTraceAsString();
    $result['response']= 'false';
    $result['exception']=$e->getMessage();

    return response()->json($result);
   /* return parent::render($request,$e);*/
}

if i update anything using composer ,will it be removed? there is any way to override handler class ?

composer update command will command to composer for generates a file called composer.lock which lists all your packages and the currently installed versions.

However, you can run composer update --no-scripts, this will run the composer update but will skip over the scripts added to the file.