InternalFormatter.js
1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var chalk_1 = __importDefault(require("chalk"));
var os = __importStar(require("os"));
var issue_1 = require("../issue");
/**
* TODO: maybe we should not treat internal errors as issues
*/
function createInternalFormatter() {
return function internalFormatter(issue) {
var color = {
message: chalk_1.default.bold.red,
stack: chalk_1.default.grey
};
if (issue.origin === issue_1.IssueOrigin.INTERNAL) {
var lines = [
color.message('INTERNAL ' + issue.severity.toUpperCase()) + ": " + issue.message
];
if (issue.stack) {
lines.push('stack trace:', color.stack(issue.stack));
}
return lines.join(os.EOL);
}
else {
throw new Error("Not supported \"" + issue.origin + "\" issue origin.");
}
};
}
exports.createInternalFormatter = createInternalFormatter;
//# sourceMappingURL=InternalFormatter.js.map