-
Notifications
You must be signed in to change notification settings - Fork 119
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
syntax error message made more verbose #1462
Conversation
made the syntax error when validating a dictionary also provide the name of the term bank that contains the error
Can you add screenshots of before and after? |
catch (error) { | ||
if (error instanceof Error) { | ||
let newError = new Error(error.message + `. Dictionary has invalid data in '${file.filename}'`); | ||
console.error(newError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use log.error
instead. log
is a wrapper around console
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Can you elaborate on what makes log.error more appropriate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check out https://github.com/themoeway/yomitan/blob/master/ext/js/core/log.js#L74. It basically formats the log with info for the extension.
catch (error) { | ||
if (error instanceof Error) { | ||
let newError = new Error(error.message + `. Dictionary has invalid data in '${file.filename}'`); | ||
console.error(newError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition, I don't think it's useful logging here and still letting the error propagate. If I decided to log the errors upstream, it would cause the error to be logged twice. You can remove the console.error entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I'll do away with it entirely.
Made changes |
when validating a dictionary as it is being imported, if a syntax error is encountered, a message would describe the syntax error that has occurred. To provide clarity, the syntax error message will now also describe the file in which this error occurred.