1 | ;
|
2 |
|
3 | const fmt = require("simple-fmt");
|
4 | const assert = require("assert");
|
5 |
|
6 | function error(line, var_args) {
|
7 | assert(arguments.length >= 2);
|
8 |
|
9 | const msg = (arguments.length === 2 ?
|
10 | String(var_args) : fmt.apply(fmt, Array.prototype.slice.call(arguments, 1)));
|
11 |
|
12 | console.error(line === -1 ? msg : fmt("line {0}: {1}", line, msg));
|
13 | error.any = true;
|
14 | }
|
15 |
|
16 | error.reset = function() {
|
17 | error.any = false;
|
18 | };
|
19 |
|
20 | error.any = false;
|
21 |
|
22 | module.exports = error;
|