[英]api platform graphql exceptions
I am using Api Platform with graphql.我正在使用 Api 平台和 graphql。
Symfony Flex, Symfony 4.4, api-platform/core v2.5.6. Symfony Flex,Symfony 4.4,API 平台/核心 v2.5.6。
When I throw exceptions in prod mode the only thing I see is the general 'Internal server error' message instead of my own exceptions messages.当我在 prod 模式下抛出异常时,我唯一看到的是一般的“内部服务器错误”消息,而不是我自己的异常消息。
{
"errors": [
{
"message": "Internal server error",
"extensions": {
"category": "internal"
}
}
}
How is it possible when I throw my own exceptions to see the messages?当我抛出自己的异常来查看消息时,怎么可能?
throw new \Exception('Show this exception message');
Thanks谢谢
You can use a custom error normalizer to add the message you want when a supported exception is thrown.您可以使用自定义错误规范器在引发支持的异常时添加所需的消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.