UNPKG

707 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var is_browser_1 = require("./is-browser");
4function cliError(err, exitOnError) {
5 if (exitOnError === void 0) { exitOnError = true; }
6 var msg;
7 if (err instanceof Error) {
8 msg = err.message || err.toString();
9 }
10 else if (typeof err === 'string') {
11 msg = err;
12 }
13 else {
14 msg = JSON.stringify(err);
15 }
16 console['error'](msg);
17 if (exitOnError && is_browser_1.isNode) {
18 process.exit(1);
19 return;
20 }
21 else if (exitOnError && is_browser_1.isBrowser) {
22 throw err;
23 }
24 return;
25}
26exports.cliError = cliError;
27//# sourceMappingURL=cli-error.js.map
\No newline at end of file