Skip to content

Commit c4f680c

Browse files
committed
Update Exception Level
Signed-off-by: cyd622 <luffywang622@gmail.com>
1 parent f3c55d8 commit c4f680c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Response/ExceptionReport.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ public function __construct(Request $request, Exception $exception)
128128
if (config('laravel_api.exception.do_report')) {
129129
$this->doReport = array_merge($this->doReport, config('laravel_api.exception.do_report'));
130130
}
131-
132131
}
133132

134133
/**
@@ -140,7 +139,13 @@ public function shouldReturn()
140139
return false;
141140
}*/
142141

143-
foreach (array_keys($this->doReport) as $report) {
142+
// 异常越靠前权重越高
143+
// FIXME 将 Exception 顶级异常放到最后
144+
$reportList = array_keys($this->doReport);
145+
unset($reportList[array_search('Exception', $reportList)]);
146+
array_push($reportList, 'Exception');
147+
148+
foreach ($reportList as $report) {
144149
if ($this->exception instanceof $report) {
145150
$this->report = $report;
146151
return true;

0 commit comments

Comments
 (0)