Skip to content

UserError Includes (Meaningless) Lines #12

Open
@machineghost

Description

@machineghost

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions