TP5.1中关于$this->success()后续继续执行,被try catch异常的捕获了导致返回一直是异常。
错误代码
try {
.......
$this->success("操作成功");
} catch (\Exception $e) {
$this->error("异常操作,{$e->getMessage()}");
}
正确代码
try {
.......
$this->success("操作成功");
}catch (HttpResponseException $exception){
throw $exception;
} catch (\Exception $e) {
$this->error("异常操作,{$e->getMessage()}");
}