Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Samples won't properly capture exceptions #242

Closed
feywind opened this issue Jan 10, 2020 · 2 comments
Closed

Samples won't properly capture exceptions #242

feywind opened this issue Jan 10, 2020 · 2 comments
Assignees
Labels
api: cloudasset Issues related to the googleapis/nodejs-asset API. priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@feywind
Copy link

feywind commented Jan 10, 2020

Just throwing this into the backlog after a discussion on nodejs-pubsub.

Specifically looking at this one, but there may be others:
https://github.com/googleapis/nodejs-asset/blob/master/samples/exportAssets.js

Because the call to the inner async function doesn't await, this won't actually catch and pass on exceptions that happen inside of it, and it'll get an unhandled rejection warning from Node. Simpler repro example:

async function main() {
	async function inner() {
		throw new Error("woo!");
	}

	inner();
}

main().catch(console.error);
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jan 11, 2020
@bcoe bcoe added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jan 14, 2020
@bcoe
Copy link
Contributor

bcoe commented Jan 14, 2020

I noticed this in a few places, and was wondering how best to address it, given our goals of a copy pastable sample... did I mention I can't wait for async/await?

@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Jan 14, 2020
@google-cloud-label-sync google-cloud-label-sync bot added the api: cloudasset Issues related to the googleapis/nodejs-asset API. label Jan 30, 2020
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Apr 30, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jul 8, 2020
@sofisl
Copy link
Contributor

sofisl commented Jul 10, 2020

Closing issue since we reassinged it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: cloudasset Issues related to the googleapis/nodejs-asset API. priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants