api 平台 graphql 异常
api platform graphql exceptions
我正在使用 Api 带有 graphql 的平台。
Symfony Flex,Symfony 4.4,api-platform/core v2.5.6。
当我在生产模式下抛出异常时,我唯一看到的是一般 'Internal server error' 消息,而不是我自己的异常消息。
{
"errors": [
{
"message": "Internal server error",
"extensions": {
"category": "internal"
}
}
}
当我抛出自己的异常时怎么可能看到消息?
throw new \Exception('Show this exception message');
谢谢
您可以使用 custom error normalizer 在抛出支持的异常时添加您想要的消息。
我正在使用 Api 带有 graphql 的平台。
Symfony Flex,Symfony 4.4,api-platform/core v2.5.6。
当我在生产模式下抛出异常时,我唯一看到的是一般 'Internal server error' 消息,而不是我自己的异常消息。
{
"errors": [
{
"message": "Internal server error",
"extensions": {
"category": "internal"
}
}
}
当我抛出自己的异常时怎么可能看到消息?
throw new \Exception('Show this exception message');
谢谢
您可以使用 custom error normalizer 在抛出支持的异常时添加您想要的消息。