Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.
I've tried to make it as lean and unobtrusive as possible.
errors/AppError.js
| public class FragmentObserver extends Observable { | |
| @Override | |
| public void notifyObservers() { | |
| setChanged(); // Set the changed flag to true, otherwise observers won't be notified. | |
| super.notifyObservers(); | |
| } | |
| } |