question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to disable stacktrace to my error responses?

See original GitHub issue

My Query:

class HelloQuery: Query {

    fun hello(): String {
        throw GraphQLException("Something Wrong!")
    }
}

application.yml

graphql:
  federation:
    enabled: true
  packages:
    - "com.aarestu"

server:
  port: 8080
  error:
    include-stacktrace: never

if I execute query:

query {
  hello
}

I got a response:

{
  "errors": [
    {
      "message": "Exception while fetching data (/hello) : Something Wrong!",
      "path": [
        "hello"
      ],
      "exception": {
        "cause": null,
        "stackTrace": [
          {
            "methodName": "hello",
            "fileName": "HelloQuery.kt",
            "lineNumber": 12,
            "className": "com.aarestu.sample.graphql.query.HelloQuery",
            "nativeMethod": false
          },
         .
         .
         .
         .
          {
            "methodName": "run",
            "fileName": "Thread.java",
            "lineNumber": 748,
            "className": "java.lang.Thread",
            "nativeMethod": false
          }
        ],
        "localizedMessage": "Something Wrong!",
        "message": "Something Wrong!",
        "suppressed": []
      },
      "locations": [
        {
          "line": 2,
          "column": 3,
          "sourceName": null
        }
      ],
      "extensions": null,
      "errorType": "DataFetchingException"
    }
  ]
}

I want to remove field exception from my error response

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dariuszkuccommented, Sep 23, 2019

Unsure whats your AppDataFetcherExceptionHandler but assuming it would return your custom GraphQLError then yes it should work.

I think by default graphql-kotlin-spring-server should not include exception stacktraces - created https://github.com/ExpediaGroup/graphql-kotlin/pull/369 to address it.

0reactions
aarestucommented, Sep 23, 2019

Awesome!! @dariuszkuc

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to prevent Internal Server Error Stack Trace from being ...
Solution. If necessary, the exceptions can be removed from the response. For example, you may customize the way the Web API handles exceptions...
Read more >
Disable the default stacktrace error response in Jetty
In your WEB-INF/web.xml just specify an HTML (or Servlet, or JSP) that can handle your error. <web-app> <error-page> <!
Read more >
How to avoid the detailed stack trace from showing up ... - IBM
But customer only wants to show an error message without detailed stack trace. This issue can be resolved via setting some WAS custom...
Read more >
Hide / Remove Stack Trace information - Microsoft Q&A
Hide / Remove Stack Trace information · Assign an error page for error 400 via IIS and restarted IIS · Ensure the following...
Read more >
Remove stack trace from APEX_ERROR in a Get response?
Anyone know how to remove the stacktrace info from the error message of custom exception? i tried overriding exception methods but it still ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found