Skip to content

Commit

Permalink
Update Exception Level
Browse files Browse the repository at this point in the history
Signed-off-by: cyd622 <luffywang622@gmail.com>
  • Loading branch information
cyd622 committed Apr 24, 2019
1 parent f3c55d8 commit c4f680c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Response/ExceptionReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public function __construct(Request $request, Exception $exception)
if (config('laravel_api.exception.do_report')) {
$this->doReport = array_merge($this->doReport, config('laravel_api.exception.do_report'));
}

}

/**
Expand All @@ -140,7 +139,13 @@ public function shouldReturn()
return false;
}*/

foreach (array_keys($this->doReport) as $report) {
// 异常越靠前权重越高
// FIXME 将 Exception 顶级异常放到最后
$reportList = array_keys($this->doReport);
unset($reportList[array_search('Exception', $reportList)]);
array_push($reportList, 'Exception');

foreach ($reportList as $report) {
if ($this->exception instanceof $report) {
$this->report = $report;
return true;
Expand Down

0 comments on commit c4f680c

Please sign in to comment.