-
Notifications
You must be signed in to change notification settings - Fork 206
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: Error constructors do not need new
#7481
Conversation
Aha! As discovered from looking at CI errors, not all |
new
a9824b7
to
22bd8c1
Compare
new
new
@@ -359,7 +359,7 @@ async function replay(transcriptFile) { | |||
} | |||
syscallResults = {}; | |||
if (divergent && !argv.ignoreConcurrentWorkerDivergences) { | |||
throw new Error('Divergent execution between workers'); | |||
throw Error('Divergent execution between workers'); |
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.
Why do this in files that aren't marked @jessy-check? What keeps them from coming back?
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.
For general stylistic consistency, and as a step towards being able to add @jessie-check to more files. Even for the files we aren't yet able to mark @jessie-check, we want as much stylistic consistency as practical with those we do.
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.
I don't disagree, but it's not clear to me how other reviewers will learn this new part of house style. I don't see what keeps the new
operators from re-appearing since, evidently, folks are used to putting them there.
Perhaps add a few reviewers to get a critical mass? In particular, kernel maintainers.
Or discuss it internally?
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.
I've been doing Error(...)
instead of new Error(...)
for as long as I can remember.
22bd8c1
to
c825df9
Compare
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.
This makes me happy.
c825df9
to
833b1c2
Compare
833b1c2
to
9981e56
Compare
See endojs/endo#1562
A step towards turning on more
@jessie-check
directives. See #3876 and #5497Jessie prohibits
new
. One trivial case of revising code to conform is to remove thenew
on calls to the*Error(
constructors. For these specifically, their construct behavior is the same as their call behavior. This also gets rid of a bit of visual noise, make code a bit more readable.Note to reviewers: I isolated this step by itself because