Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve error handling #103

Open
dwmkerr opened this issue May 3, 2019 · 0 comments
Open

refactor: improve error handling #103

dwmkerr opened this issue May 3, 2019 · 0 comments

Comments

@dwmkerr
Copy link
Owner

dwmkerr commented May 3, 2019

Might be easier to just do:

console.error('An error occurred labelling the icon: ${err}');

Another improvement would be to perhaps standardise the error logging a little, to make sure we print in colour, using chalk, and perhaps even only show the internal error message if a verbose flag like -v is set - but this can happen later.

It also means we could potentially simplify things with something like:

function errorAndExit(errorMessage, internalError, verbose, exitCode) {
   console.error(`${chalk.red('error')}: ${errorMessage}`);
   if (verbose) {
     console.error(`${chalk.red('internal error')}: ${(internalError || '').toString()}`);
   }
   process.exit(exitCode);
}

Also really I should document in the README what the error codes are and actually use separate error codes for separate conditions, but that's an improvement for another time.

Originally posted by @dwmkerr in #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant