then(function ($response) { Log::info('微信支付异步回调返回数据:' . $response->getBody()); return json_decode((string)$response->getBody()); }) ->otherwise(function ($e) { if ($e instanceof RequestException && $e->hasResponse()) { $content = $e->getResponse()->getBody()->getContents(); Log::error('微信支付异步回调错误:' . $content); if (json_validate($content)) { $errorBody = json_decode($content); throw new ErrorException(severity: $e->getCode(), message: trim($errorBody->message)); } } throw $e; }) ->wait(); } }