Как удалить «местоположения» и «путь» из ответа? (Я хочу иметь «ошибки» только с «сообщением» и «данными»).
Например:
Код: Выделить всё
public function doSomething($_, array $args, GraphQLContext $context, ResolveInfo $resolveInfo){
$apples_count = $context->user()->apples;
if(apples_count > 10){
//do something
return [
'success' => true
];
}else{
throw new Error('You must have more then 10 apples');
}
}
Код: Выделить всё
{
"errors": [
{
"message": "You must have more then 10 apples",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"doSomething"
]
}
],
"data": {
"doSomething": null
}
}
[*]Создал свой собственное исключение
[*]Изменены APP_DEBUG=false и APP_ENV=production
[*]Добавлен LIGHTHOUSE_DEBUG=null|false|0
Подробнее здесь: https://stackoverflow.com/questions/786 ... e-response