npm's error handler as a separate module