tc39 / proposal-is-error

ECMAScript Proposal, specs, and reference implementation for Error.isError
https://tc39.es/proposal-is-error/
MIT License
74 stars 2 forks source link

Use case? #3

Closed paulmillr closed 8 years ago

paulmillr commented 8 years ago

Could you provide a use case for checking whether the variable is an error? Was thinking of something practical but wasn't able to remember anything

ljharb commented 8 years ago

One is in #2, but primarily it's to unforge-ably (not Object#toString in ES6) and cross-realm (not instanceof) detect whether something is an Error instance, for to know if the stack trace on it is reliable (wrt the current engine's reliability in that regard)

paulmillr commented 8 years ago

Thanks!