Description
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?