custom-error-class
Straightforward ES6 class you can extend to make custom errors that are all instanceof
Error with proper stacks.
npm install custom-error-class
Usage
const CustomError ={super'an error happened'thiscode = 'SOME_CODE'}// Use this error as you normally would.throw
Credits to @pfrazee who wrote most of it.
License
MIT