【发布时间】:2018-06-15 11:00:48
【问题描述】:
虽然我遇到的错误本身也是一个问题,但我当前的特殊问题是我什至无法读取一半的错误,因为它被截断了, 所以我不知道错误实际上是什么是。
终端
$ 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)
这个错误显然是由我的异常控制器给出的。
ExceptionController.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());
}
...
如何丢失截断并查看完整错误?
【问题讨论】:
-
通过检查日志文件
-
所以
./var/log/dev.log就是答案。谢谢。