Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Mar 17, 2020
1 parent 9108649 commit 3160123
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions packages/kbn-dev-utils/src/run/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import { inspect } from 'util';

// @ts-ignore @types are outdated and module is super simple
import exitHook from 'exit-hook';

Expand Down Expand Up @@ -62,8 +64,11 @@ export async function run(fn: RunFn, options: Options = {}) {

process.on('unhandledRejection', error => {
log.error('UNHANDLED PROMISE REJECTION');
if (error instanceof Error || typeof error === 'string') log.error(error);
else log.error(String(error));
log.error(
error instanceof Error
? error
: new Error(`non-Error type rejection value: ${inspect(error)}`)
);
process.exit(1);
});

Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39806,6 +39806,7 @@ exports.isFailError = fail_1.isFailError;
*/
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = __webpack_require__(36);
const util_1 = __webpack_require__(29);
// @ts-ignore @types are outdated and module is super simple
const exit_hook_1 = tslib_1.__importDefault(__webpack_require__(348));
const tooling_log_1 = __webpack_require__(415);
Expand All @@ -39825,10 +39826,9 @@ async function run(fn, options = {}) {
});
process.on('unhandledRejection', error => {
log.error('UNHANDLED PROMISE REJECTION');
if (error instanceof Error || typeof error === 'string')
log.error(error);
else
log.error(String(error));
log.error(error instanceof Error
? error
: new Error(`non-Error type rejection value: ${util_1.inspect(error)}`));
process.exit(1);
});
const handleErrorWithoutExit = (error) => {
Expand Down

0 comments on commit 3160123

Please sign in to comment.