UNPKG

@sap/cli-core

Version:

Command-Line Interface (CLI) Core Module

23 lines (22 loc) 690 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.create = void 0; const logger_1 = require("../../logger"); const create = (handler) => { const { stack } = new Error(); return async (command) => { const commandHandler = await handler(command); return async (...args) => { try { await commandHandler(...args); } catch (err) { const { trace } = (0, logger_1.get)("commands.handler.stackTrace"); trace("handler was created from:", stack); throw err; } }; }; }; exports.create = create; /* jscpd:ignore-end */