-
Notifications
You must be signed in to change notification settings - Fork 212
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
Clear up uncertain await safety #6739
Conversation
31b48ed
to
494c518
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.
LGTM!!!
OMG Am I happy to see this!
packages/agoric-cli/src/deploy.js
Outdated
@@ -367,12 +371,11 @@ export { bootPlugin } from ${JSON.stringify(absPath)}; | |||
console.info(`Loading plugin ${JSON.stringify(pluginFile)}`); | |||
return E.get(E(pluginManager).load(pluginName, pluginOpts)) | |||
.pluginRoot; | |||
} catch (e) { | |||
}).catch(e => { |
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.
}).catch(e => { | |
})().catch(e => { |
Uh oh. A hazard of the new approach. Surprised the type checker didn't flag it, since the left operand of the .catch
is a function. Any idea why not?
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.
Typescript checks weren't enabled for this file. It has other type problems that I haven't addressed yet, but are likely outside the scope of this PR.
await main(bootP, { | ||
bundleSource: (file, options = undefined) => | ||
bundleSource(pathResolve(file), options), | ||
cache, |
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.
How does dropping cache
relate to the other changes of this PR?
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.
That seems to be a remnant of a drive-by fix I did in my work tree. cache
wasn't well-thought-out, and its (invalid) initialisation caused some unhandled rejections that worried our developers. So it's gone for now.
494c518
to
897a2f8
Compare
897a2f8
to
3524569
Compare
closes: #6226
closes: #6227
closes: #6232
closes: #6233
closes: #6234
closes: #6235
Description
This may serve as a demonstration of idioms to honour the Jessie await rules, most interestingly:
while
loops with nested awaits asfor-await-of
loops with a Jessie-style async generator.try
with nested awaits into an async IIFE with a catch method (await (async () => { ... })().catch(e => { ... })
). It's less readable, but much more explicit.Also, I disabled eslint's
no-continue
rule for the Agoric SDK.Security Considerations
Documentation Considerations
Testing Considerations