rms*_*ers 0 php truncated symfony
虽然我遇到的错误本身也是一个问题,但我当前的特殊问题是我什至无法读取一半的错误,因为它被截断了,所以我不知道错误究竟是什么。
终端
$ vendor/bin/behat features/album.feature
Feature: Provide a consistent standard JSON API endpoint
In order to build interchangeable front ends
As a JSON API developer
I need to allow Create, Read, Update, and Delete functionality
Background: # features\album.feature:7
Given there are Albums with the following details: # FeatureContext::thereAreAlbumsWithTheFollowingDetails()
| title | track_count | release_date |
| The Dark side of the Moon | 12 | 1973-03-24T00:00:00+00:00 |
| Back in Black | 9 | 1980-06-25T23:22:21+00:00 |
| Thriller | 23 | 1982-11-30T11:10:09+00:00 |
Server error: `POST http://127.0.0.1:8000/api/album` resulted in a `500 Internal Server Error` response:
{
"code": 500,
"message": "Unexpected error occured: An exception occurred while executing 'INSERT INTO Album (t (truncated...)
(GuzzleHttp\Exception\ServerException)
Run Code Online (Sandbox Code Playgroud)
该错误显然是由我的异常控制器给出的。
异常控制器.php
...
/**
* @Rest\View()
* @param Request $request
* @param $exception
* @param DebuggerLoggerInterface|null $logger
* @return View
*/
public function show(Request $request, $exception, DebugLoggerInterface $logger = null){
if ($exception instanceof ValidationException) {
return $this->getView($exception->getStatusCode(), json_decode($exception->getMessage(), true));
}
if ($exception instanceof HttpException) {
return $this->getView($exception->getStatusCode(), $exception->getMessage());
}
return $this->getView(null, 'Unexpected error occured: '.$exception->getMessage());
}
...
Run Code Online (Sandbox Code Playgroud)
如何丢失截断并查看完整错误?
小智 6
你可以去 vendor\guzzlehttp\guzzle\src\Exception\RequestException.php 第 139 行。
并更改这一行: $summary = $body->read(120); 您应该能够读取 120 多个字节并更好地了解您遇到的错误。(仅用于调试)
| 归档时间: |
|
| 查看次数: |
1501 次 |
| 最近记录: |