node-redis
node-redis copied to clipboard
Why is `ErrorReply` stack being erased?
I'm trying to trace some errors in my aplication and spent a couple hours trying to figure out where this is coming from. Just to eventually trace it down to this line.
https://github.com/redis/node-redis/blob/master/packages/client/lib/errors.ts#L63
Why on earth is this being deleted?
Because the stack has nothing to do with the error + the stack trace won't be that useful. Having said that, if you think it's useful we can remove this line...
@simonprickett @guyroyse WDUT?
Because the stack has nothing to do with the error + the stack trace won't be that useful. Having said that, if you think it's useful we can remove this line...
@simonprickett @guyroyse WDUT?
I think you are right.
What broke in my code is that I assume Error children have a stack.
Nevertheless, I think it's useful to see the unrelated stack trace regardless. So you at least have a little direction.
According to errorstack docs
The first line is formatted as <error class name>: <error message>, and is followed by a series of stack frames (each line beginning with "at ")
why not leave <error message> instead of undefined, in order not to break the code that relies on standard stack format?
How do we identify which command in a function containing multiple commands actually originated the error.
In my case I am using MULTI, which makes sense that the stack trace for the individual commands ReplyErrors would not be useful. But the error I am getting doesn't actually provide a command name for what caused the error. So I assume that the error in JavaScript is actually be thrown from EXEC but this gives me so little information to try to troubleshoot the problem.
[MultiErrorReply: 1 commands failed, see .replies and .errorIndexes for more information] {
replies: [
1,
true,
[ErrorReply: WRONGTYPE Operation against a key holding the wrong kind of value]
],
errorIndexes: [ 2 ]
}
Did I miss somewhere in the documentation where this error structure is explained?
"see .replies and .errorIndexes for more information" is only useful if some explanation is given for what those values mean.