UNPKG

trapx

Version:

A plug-and-play middleware for standardized error handling in TypeScript-based Express.js applications

15 lines (14 loc) 413 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatError = formatError; function formatError(error, includeStack) { return { success: false, error: { message: error.message, code: error.code, ...(error.details && { details: error.details }), ...(includeStack && { stack: error.stack }) } }; }