Skip to content
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

Catch error if no account selected in window pop up (Unhandled Promise Rejection: Error: Popup window closed) #35

Closed
syedkhairi opened this issue Feb 2, 2025 · 2 comments · Fixed by #39
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Milestone

Comments

@syedkhairi
Copy link

Hello!

Just wondering if possible to return error on picker:error if the retrieveAccessToken throw error. For example, if the user did not select any account when pop up window appeared, which caused [Error] Unhandled Promise Rejection: Error: Popup window closed (anonymous function) (@googleworkspace_drive-picker-element.js:91:172)

I assume adding catch and dispatch to picker:error to say no access token?

// OAuth token is required either as an attribute or from the OAuth flow using the client ID and scope
const oauthToken =
	this.getAttribute("oauth-token") ??
	(await retrieveAccessToken(
		// biome-ignore lint/style/noNonNullAssertion: just let the error bubble up when null
		this.getAttribute("client-id")!,
		this.getAttribute("scope") ??
			"https://www.googleapis.com/auth/drive.file",
	).then((token) => {
		this.dispatchEvent(
			new CustomEvent("picker:authenticated", { detail: { token } }),
		);
		return token;
	}));

At the moment, using this on Svelte, with a button state to toggle component, but if the popup window closed without account selection, no callback to reset the button state.

@jpoehnelt
Copy link
Member

Need to implement the error_callback and response.error.

@jpoehnelt jpoehnelt added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Feb 9, 2025
@jpoehnelt jpoehnelt added this to the v1 milestone Feb 10, 2025
@jpoehnelt
Copy link
Member

See #37 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants