Closed stevenvachon closed 4 years ago
Hi, sorry for picking this up so late! Seems my notifications had failed me back then. I haven't seen this used in the wild; can you establish it is a somewhat widespread technique?
Probably not a widespread technique, but supporting it would be more complete.
I'm not convinced (yet) it's worth the extra code to maintain. I'll keep this open for more discussion; also anyone please feel free to vote thumbs up/down on the opening post. A feature poll will probably always be biased towards people interested, but it might nonetheless help convince me.
I think I totally misunderstood your request. I assumed you wanted the fake error to be reported as an error. Now by chance I found out, that is the current behavior. So did you mean you want FakeErrors to not be counted as errors? Would make sense as, at least in your very basic example above, they don't carry .name
, .message
, .stack
etc. (comparison script)
I've considered this a bit more, and I decided that assigning a toStringTag Symbol of Error
is clear indication that whoever writes the assignment, wants the object to be treated as an error.
is-error
v2.2.2 on Node.js v8.16.2, Ubuntu 14.04.6 LTS trusty, accepts this effort and judges the object is a legitimate error (true
result). This is the intended behavior.
is-error
does NOT accept the toStringTag
ged error, please report it as a defect in a new issue, including details about the software versions you use.