Skip to content

Conversation

@Ugonnaak1
Copy link
Contributor

Aimed to solve the problem discussed here:
Solution 5 implementation

@Ugonnaak1 Ugonnaak1 requested a review from a team as a code owner October 30, 2025 04:04
Copilot AI review requested due to automatic review settings October 30, 2025 04:04
Copy link
Contributor

Copilot AI left a 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 NativeAuthError class in msal-common to preserve broker-specific error details (status code and tag)
  • Adds msalNodeRuntimeError property to AuthError base class to hold the original native error
  • Modifies error wrapping logic in NativeBrokerPlugin to attach NativeAuthError instances 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

@Ugonnaak1 Ugonnaak1 requested a review from tnorling November 7, 2025 17:18
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.

3 participants