(action: CommanderAction)
| 8 | export type CommanderAction = (...args: any[]) => void | Promise<void>; |
| 9 | |
| 10 | export function wrapAction(action: CommanderAction): CommanderAction { |
| 11 | return async (...args: any[]) => { |
| 12 | try { |
| 13 | await action(...args); |
| 14 | } catch (e) { |
| 15 | if (isFatal(e)) { |
| 16 | process.exitCode = e.exitCode; |
| 17 | logger.error(e.message); |
| 18 | } else { |
| 19 | throw e; |
| 20 | } |
| 21 | } |
| 22 | }; |
| 23 | } |
no test coverage detected