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.

throw from resolver should not be logged

See original GitHub issue

@steida commented on Mon Feb 26 2018

Maybe I am wrong, but

const throwError = (error /*: ServerError */) => {
  throw new Error(JSON.stringify(error));
};

const throwNotAuthorizedError = () => throwError({ type: 'notAuthorized' });

Seems to be a recommended way how to stop resolver, but then probably this should not be logged.

screen shot 2018-02-26 at 02 03 45

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:21 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MohamedElmdarycommented, Dec 8, 2018

@marktani if you still facing this problem you need to add debug: false in start options

const options = {
  port: 8080,
  endpoint: "/graphql",
  subscriptions: "/subscriptions",
  playground: "/playground",
  formatError(err: any): any {
    return err.message;
  },
  debug: false // this would prevent logs
};

server.start(options, () => {
  console.log("server started!");
});
1reaction
schicklingcommented, May 25, 2018

@timsuchanek @divyenduz can you describe a couple of approaches here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

throw from resolver should not be logged · Issue #199 - GitHub
@johannpinson Hi, how do you manage to make the error response log disappears? I tried the following: import {ApolloError} from 'apollo-server-errors'; // and ......
Read more >
Error handling - Apollo GraphQL Docs
Throwing errors​​ For example, it throws a GRAPHQL_VALIDATION_FAILED error whenever an incoming operation isn't valid against the server's schema. Your resolvers ...
Read more >
Why is "log and throw" considered an anti-pattern? [closed]
The cross-cutting concerns argument is basically that it is a waste of time handling errors that don't concern you. Far better to let...
Read more >
Resolve or Die - Error Handling Strategies for Loading Data in ...
If you are using a Route Resolver, and it encounters an unhandled exception, the route will not resolve, and your page will simply...
Read more >
Handling GraphQL errors like a champ with unions and ...
No type error will be thrown if you mistype the error message or extension code inside your resolvers. The GraphQL engine does not...
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