UNPKG

@practica/create-node-app

Version:

Create Node.js app that is packed with best practices AND strive for simplicity

24 lines (23 loc) 701 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppError = exports.errorHandler = void 0; // This file simulates real-world error handler that makes this component observable const errorHandler = { handleError: async (errorToHandle) => { try { console.error(errorToHandle); } catch (e) { // Continue the code flow if failed to handle the error console.log(`handleError threw an error ${e}`); } }, }; exports.errorHandler = errorHandler; class AppError extends Error { constructor(name, message) { super(message); this.name = name; } } exports.AppError = AppError;