-
Notifications
You must be signed in to change notification settings - Fork 213
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
Use async/await in samples #193
Conversation
FWIW the GCF samples include both 6 and 8 (where applicable).
Do we have any relevant data here? (Ping us internally if it's non-public.)
…On Sun, Sep 16, 2018, 6:43 PM Justin Beckwith ***@***.***> wrote:
Mostly doing this to start a conversation :) What do y'all think of using
async/await in our samples? I figure, we tell people to start with the
latest LTS version of nodejs, which is 8 at this stage 🤷♂️ Node.js 6 is
6 months from death, so I don't feel too bad doing this just in the samples.
Thoughts?
@googleapis/node-team <https://github.com/orgs/googleapis/teams/node-team>
@fhinkel <https://github.com/fhinkel> @ace-n <https://github.com/ace-n>
------------------------------
You can view, comment on, or merge this pull request online at:
#193
Commit Summary
- Use async/await in samples
File Changes
- *M* samples/datasets.js
<https://github.com/googleapis/nodejs-bigquery/pull/193/files#diff-0>
(52)
- *M* samples/queries.js
<https://github.com/googleapis/nodejs-bigquery/pull/193/files#diff-1>
(96)
- *M* samples/quickstart.js
<https://github.com/googleapis/nodejs-bigquery/pull/193/files#diff-2>
(19)
- *M* samples/tables.js
<https://github.com/googleapis/nodejs-bigquery/pull/193/files#diff-3>
(211)
Patch Links:
- https://github.com/googleapis/nodejs-bigquery/pull/193.patch
- https://github.com/googleapis/nodejs-bigquery/pull/193.diff
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#193>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ACM8xQwz3gkHBiMuk62MBGzGH011bAZoks5ubv40gaJpZM4WrJ9y>
.
|
At this point it makes sense for the samples to assume async/await support. Node 6 will be EOL in April. It is declining in usage (see https://nodejs.org/metrics) and already Node 8 seems be getting 3x the downloads as Node 6. |
Yeah, I think we can start with |
@fhinkel what are your thoughts on the way I eliminated the error handling? We used to console.log the errors, now I am just letting the async method throw. Is this the pattern we want to roll with for our samples? |
Looks good. You'd still see the error message in the stack trace, right? Maybe add one example that uses the |
So anyone willing to approve it then? 🤣 |
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.
Pretty!
(Not that my approval counts in nodejs-land)
🤷♂️ I'll take it |
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 is really nice!
.catch(err => { | ||
console.error('ERROR:', err); | ||
}); | ||
const [rows] = await bigquery.query(options); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Mostly doing this to start a conversation :) What do y'all think of using async/await in our samples? I figure, we tell people to start with the latest LTS version of nodejs, which is 8 at this stage 🤷♂️ Node.js 6 is 6 months from death, so I don't feel too bad doing this just in the samples.
Thoughts?
@googleapis/node-team @fhinkel @ace-n