Skip to content

Commit

Permalink
feat: exposes pretty-error
Browse files Browse the repository at this point in the history
  • Loading branch information
AutoSponge committed Mar 30, 2020
1 parent a0542c1 commit 3c367bc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/scriptwriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const EVENT_ENTER = 'enter';
const config = new Map();
const company = new Map();
const completions = new Set();
const prettyError = new PrettyError();

process.on('unhandledRejection', error => {
const err = new PrettyError();
console.log(err.render(error));
process.on('unhandledRejection', error => {
console.log(prettyError.render(error));
});

/**
Expand Down Expand Up @@ -186,4 +186,12 @@ module.exports = class Scriptwriter extends EventEmitter {
/* istanbul ignore next */
console.log(...args);
}
/**
* @param {...any} args
*/
error(...args) {
this.emit('error', args);
if (process.env.NODE_ENV === 'test') return;
console.log(prettyError.render(...args))
}
};

0 comments on commit 3c367bc

Please sign in to comment.