Error vs Error3. Seven reasons why you should switch

It has no structured stack trace

Oh, but then again, neither does your library, right?

In any case, I wasn't arguing any of these:

  • That native Error is great, or even good in general.
  • That your library doesn't add anything over it
  • That codes aren't a good thing

Instead, my argument is more like this:

  • Native Error is good enough as a base to extend.
  • Most places I've been, usually prefer defining more precisely how they extend the native Error.
  • The thing about code was just an example of the previous point. Sure, most people will want error codes, but not all. And more importantly, a lot of people will not want a generic container like your details and/or the errors collection. Also, regarding code, the thing is it's very easy to add the property and requires little effort, while there are other, much more important concerns about error codes.
/r/javascript Thread Parent