Browse Source
Unlike strings, Error objects allow you to get stack traces. Also, a lot of libraries will complain if they encounter a thrown non-Error object. This is in line with standard Javascript best practices. Per https://eslint.org/docs/rules/no-throw-literal: > It is considered good practice to only throw the Error > object itself or an object using the Error object as base > objects for user-defined exceptions. The fundamental benefit of > Error objects is that they automatically keep track of where they > were built and originated.pull/497/head
2 changed files with 5 additions and 5 deletions
Loading…
Reference in new issue