Skip to content

Commit 5ecdba1

Browse files
authored
Add support for "pageException" error to fallback to web (#8064)
`PageException` is currently not being handled as a fatal error by MSAL JS, but the server falls back to web if it encounters the same. This PR addresses the gap.
1 parent 721c033 commit 5ecdba1

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Add support for \"pageException\" error to fallback to web (#8064)",
4+
"packageName": "@azure/msal-browser",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

lib/msal-browser/src/error/NativeAuthError.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export function isFatalNativeAuthError(error: NativeAuthError): boolean {
6767

6868
switch (error.errorCode) {
6969
case NativeAuthErrorCodes.contentError:
70+
case NativeAuthErrorCodes.pageException:
7071
return true;
7172
default:
7273
return false;

lib/msal-browser/src/error/NativeAuthErrorCodes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
*/
55

66
export const contentError = "ContentError";
7+
export const pageException = "PageException";
78
export const userSwitch = "user_switch";

lib/msal-browser/test/error/NativeAuthError.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ describe("NativeAuthError Unit Tests", () => {
6363
expect(isFatalNativeAuthError(error)).toBe(true);
6464
});
6565

66+
it("should return true for isFatal when extension throws an error", () => {
67+
const error = new NativeAuthError(
68+
NativeAuthErrorCodes.pageException,
69+
"extension threw error"
70+
);
71+
expect(isFatalNativeAuthError(error)).toBe(true);
72+
});
73+
6674
it("should return false for isFatal", () => {
6775
const error = new NativeAuthError(
6876
"testError",

0 commit comments

Comments
 (0)