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
Chore: Error => TypeError #9390
Conversation
LGTM |
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.
LGTM, thanks for contributing!
lib/util/node-event-generator.js
Outdated
@@ -160,7 +160,7 @@ function tryParseSelector(rawSelector) { | |||
return esquery.parse(rawSelector.replace(/:exit$/, "")); | |||
} catch (err) { | |||
if (typeof err.offset === "number") { | |||
throw new Error(`Syntax error in selector "${rawSelector}" at position ${err.offset}: ${err.message}`); | |||
throw new TypeError(`Syntax error in selector "${rawSelector}" at position ${err.offset}: ${err.message}`); |
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.
Is a TypeError
semantically correct here (as opposed to, e.g. a SyntaxError
)? This error doesn't seem to relate to types.
LGTM |
What is the purpose of this pull request? (put an "X" next to item)
[x] Other, please explain:
throw a TypeError after a type checking if-statement, instead of a generic Error.
What changes did you make? (Give an overview)
Is there anything you'd like reviewers to focus on?