Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserError Includes (Meaningless) Lines #12

Open
machineghost opened this issue Jan 30, 2018 · 0 comments
Open

UserError Includes (Meaningless) Lines #12

machineghost opened this issue Jan 30, 2018 · 0 comments

Comments

@machineghost
Copy link

In the definition of UserError it does:

Error.captureStackTrace(this, 'Error');

I'm pretty sure this is what causes my returned errors to look like this (note the meaningless "locations" value):

"errors": [
    {
      "message": "The string I passed to UserError",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    }
  ]

Obviously the locations bit doesn't hurt anything (as without a filename or a complete stack you can't really do anything with the line numbers) ... but at the same time, in a library that's all about hiding unnecessary information from the user, it's strange that I'm forced to send this unnecessary information to the user anytime I want to provide error information that's visible client-side.

Would it be possible to add an argument to UserError to let one specify "don't add the locations to this error"? Or better yet, maybe just make that the default behavior, because line numbers without files will never be useful to anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant