UNPKG

478 BJavaScriptView Raw
1"use strict";
2
3const fmt = require("simple-fmt");
4const assert = require("assert");
5
6function 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
16error.reset = function() {
17 error.any = false;
18};
19
20error.any = false;
21
22module.exports = error;