1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var is_browser_1 = require("./is-browser");
|
4 | function 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 | }
|
26 | exports.cliError = cliError;
|
27 |
|
\ | No newline at end of file |