Skip to content

Commit 83d407b

Browse files
committed
fix(repo): 拼接字符串后面跟的 $reason 是对象导致异常退出任务
1 parent 0258f57 commit 83d407b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

laravel/app/Http/Repository/MultithreadingRepository.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,13 @@ public function newRequest($url, $appkey)
303303
},
304304
'rejected' => function($reason, $index) {
305305
// this is delivered each failed request
306-
Log::error('request-failed: ID-'.$index, ['reason' => $reason]);
306+
if (is_object($reason) && is_callable([$reason, 'getMessage'])) {
307+
$reason = 'Line:'.$reason->getLine().' in '.$reason->getFile().'; Message: '.$reason->getMessage();
308+
}
309+
Log::error('MultithreadingRepository.php Line:309 Get Failed Request: ', ['ExcelName' => $this->fileName, 'Index' => $index, 'Param' => $this->dataSet['data'][$index], 'Error' => $reason]);
307310
$this->data[$index] = '';
308-
//return 'Index: '.$index.' Reason:'.$reason;
311+
// 拼接字符串--后面跟的 $reason 是对象导致异常退出任务
312+
// return 'Index: '.$index.' Reason:'.$reason;
309313
},
310314
]);
311315

0 commit comments

Comments
 (0)