(err: Error | null | undefined | {})
| 103 | } |
| 104 | |
| 105 | export function handleUnhandledRejection(err: Error | null | undefined | {}) { |
| 106 | // eslint-disable-next-line no-console |
| 107 | console.error('** unhandled rejection found, please make sure the promise is resolved/rejected correctly! **'); |
| 108 | if (err instanceof Error) { |
| 109 | return handleErrorAndExit(err, process.argv[2]); |
| 110 | } |
| 111 | console.error(err); // eslint-disable-line |
| 112 | return handleErrorAndExit(new Error(`unhandledRejections found. err ${err}`), process.argv[2]); |
| 113 | } |
| 114 | |
| 115 | export function logErrAndExit(err: Error | string, commandName: string) { |
| 116 | if (!err) throw new Error(`logErrAndExit expects to get either an Error or a string, got nothing`); |
no test coverage detected