Skip to content

Conversation

hectormmg
Copy link
Member

No description provided.

@Copilot Copilot AI review requested due to automatic review settings July 1, 2025 19:52
@hectormmg hectormmg changed the base branch from dev to msal-v5 July 1, 2025 19:52
@github-actions github-actions bot added documentation Related to documentation. msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package extensions Related to extensions for the base libraries labels Jul 1, 2025
Copy link
Contributor

@Copilot 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 refactors error handling, telemetry, and cache interface code to centralize default messages, standardize constant usage, and enhance telemetry correlation.

  • Replaced inline error message maps with a shared getDefaultErrorMessage helper.
  • Updated many modules to import from a unified Constants module and swapped to the new PerformanceEvents exports.
  • Changed ICacheManager remove methods to require a correlationId and return void, and updated implementations accordingly.

Reviewed Changes

Copilot reviewed 205 out of 428 changed files in this pull request and generated no comments.

File Description
src/error/ClientAuthError.ts Removed hardcoded ClientAuthErrorMessages and simplified constructor to use default messages.
src/error/AuthError.ts & CacheError.ts Introduced getDefaultErrorMessage, removed inline message maps, and adjusted super() calls.
src/cache/interface/ICacheManager.ts & CacheManager.ts Changed removeAccount/removeAccessToken/etc. signatures to take a correlationId and return void.
Comments suppressed due to low confidence (4)

lib/msal-common/src/error/ClientAuthErrorCodes.ts:21

  • The literal uses mixed casing (appMetadata) in the snake_case string. For consistency with other codes, consider "multiple_matching_app_metadata".
export const multipleMatchingAppMetadata = "multiple_matching_appMetadata";

lib/msal-common/src/error/ClientAuthError.ts:19

  • By passing only additionalMessage here, the original descriptive message for errorCode is lost whenever additionalMessage is provided. Consider fetching the default description and concatenating, e.g.: const baseMsg = getDefaultErrorMessage(errorCode); super(errorCode, additionalMessage ? ${baseMsg}: ${additionalMessage} : baseMsg);
        super(errorCode, additionalMessage);

lib/msal-common/src/error/CacheError.ts:26

  • The thrown error message no longer includes the errorCode prefix, breaking consistency with other errors. Consider using super(${errorCode}: ${message}); so the code remains part of the message.
        super(message);

lib/msal-common/src/cache/interface/ICacheManager.ts:200

  • The signature change to require a correlationId breaks existing callers of removeAllAccounts() with no arguments. Either update all call sites to pass the correlationId or consider overloading/retaining a zero-arg version for backward compatibility.
    removeAllAccounts(correlationId: string): void;

Copy link
Contributor

Reminder: This PR appears to be stale. If this PR is still a work in progress please mark as draft.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Related to documentation. extensions Related to extensions for the base libraries msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants