-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Handle MsalRuntime Error Surfacing #8120
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
base: dev
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR enhances error handling for MSAL Runtime (native broker) errors by introducing a new NativeAuthError class and attaching it to wrapped MSAL.js errors. The key purpose is to preserve detailed broker error information (status code, tag) when native broker errors are converted to standard MSAL errors.
Key changes:
- Introduces
NativeAuthErrorclass inmsal-commonto preserve broker-specific error details (status code and tag) - Adds
msalNodeRuntimeErrorproperty toAuthErrorbase class to hold the original native error - Modifies error wrapping logic in
NativeBrokerPluginto attachNativeAuthErrorinstances to all wrapped errors
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/msal-common/src/exports-common.ts | Exports the new NativeAuthError class from msal-common package |
| lib/msal-common/src/error/NativeAuthError.ts | Defines new error class that extends AuthError with broker-specific properties (statusCode, tag) |
| lib/msal-common/src/error/AuthError.ts | Adds optional msalNodeRuntimeError property to store the original native broker error |
| extensions/msal-node-extensions/src/broker/NativeBrokerPlugin.ts | Refactors error wrapping to create NativeAuthError once and attach it to all wrapped errors via msalNodeRuntimeError property |
| extensions/msal-node-extensions/test/broker/NativeBrokerPlugin.spec.ts | Adds test to verify msalNodeRuntimeError is properly attached to wrapped errors |
Aimed to solve the problem discussed here:
Solution 5 implementation