简体   繁体   中英

api platform graphql exceptions

I am using Api Platform with graphql.

Symfony Flex, Symfony 4.4, api-platform/core 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.

{
  "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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM