Skip to content

Commit

Permalink
use eslint/prettier like error reporting
Browse files Browse the repository at this point in the history
to see if GitHub picks up errors in UI
  • Loading branch information
sidvishnoi committed Mar 27, 2021
1 parent 4e137cc commit 70fd420
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tools/respec2html.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,25 @@ class Logger {
* @param {RsError} rsError
*/
error(rsError) {
const header = colors.bgRed.white.bold("[ERROR]");
const message = colors.red(this._formatMarkdown(rsError.message));
console.error(header, message);
if (rsError.plugin) {
this._printDetails(rsError);
if (rsError.location) {
for (const loc of rsError.location) {
const [file, lineNumber] = loc.split(":");
console.error(file);
console.error(` ${lineNumber}:0`, "error", message);
}
}
}

/** @param {RsError} rsError */
warn(rsError) {
const header = colors.bgYellow.black.bold("[WARNING]");
const message = colors.yellow(this._formatMarkdown(rsError.message));
console.error(header, message);
if (rsError.plugin) {
this._printDetails(rsError);
if (rsError.location) {
for (const loc of rsError.location) {
const [file, lineNumber] = loc.split(":");
console.error(file);
console.error(` ${lineNumber}:0`, "warning", message);
}
}
}

Expand Down

0 comments on commit 70fd420

Please sign in to comment.