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

Ensure errors thrown when monitoring window are caught and handled #1113

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

jasonnutter
Copy link
Contributor

@jasonnutter jasonnutter commented Nov 14, 2019

Currently, when monitorWindowForHash threw an error, it wasn't properly caught, which resulted in unhandled rejection errors (and the inability for apps to catch and handle these errors on their own). This PR ensures that these errors are caught, and properly passed up to the call site that initiate the request.

@jasonnutter jasonnutter force-pushed the catch-unhandled-rejections branch from a9510b0 to afaf7f8 Compare November 14, 2019 01:43
@@ -34,6 +34,8 @@ export default C =>
return redirect
? msalApp.acquireTokenRedirect(request)
: msalApp.acquireTokenPopup(request);
} else {
console.error('Non-interactive error:', error.errorCode)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout errors were previously not bubbling up to the call site in the application.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 74.668% when pulling afaf7f8 on catch-unhandled-rejections into 8f9b815 on dev.

@@ -1260,7 +1268,7 @@ export class UserAgentApplication {
this.registerCallback(serverAuthenticationRequest.state, scope, resolve, reject);
this.logger.infoPii("Navigate to:" + urlNavigate);
frameHandle.src = "about:blank";
this.loadIframeTimeout(urlNavigate, frameName, scope);
this.loadIframeTimeout(urlNavigate, frameName, scope).catch(error => reject(error));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why in some places we have if (reject) after catching the error and sometimes not?

Copy link
Member

@sameerag sameerag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm. Test manually once before dev release.

@sameerag sameerag merged commit f1845a6 into dev Nov 14, 2019
@sameerag sameerag deleted the catch-unhandled-rejections branch November 14, 2019 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants