Par*_*lam 3 laravel guzzlehttp
Guzzle http 正在截断超过 120 个字符的异常,但我需要记录完整的异常消息。我怎样才能做到这一点?
我正在使用 Laravel 4.2.22。
Yam*_*raf 26
try {
// whatever
} catch (\GuzzleHttp\Exception\RequestException $ex) {
return $ex->getResponse()->getBody()->getContents();
// you can even json_decode the response like json_decode($ex->getResponse()->getBody()->getContents(), true)
}
Run Code Online (Sandbox Code Playgroud)
Laravel 5 和 4 是一样的
try {
$response = $client->post($path, $params);
} catch (\GuzzleHttp\Exception\RequestException $ex) {
\Log::debug('error');
\Log::debug((string) $ex->getResponse()->getBody());
throw $ex;
}
Run Code Online (Sandbox Code Playgroud)
如果你只是去$ex->getMessage(),你会
(truncated...)
到最后。
| 归档时间: |
|
| 查看次数: |
5003 次 |
| 最近记录: |