MsalException Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Base exception type thrown when an error occurs during token acquisition. For more details, see https://aka.ms/msal-net-exceptions
public class MsalException : Exception
type MsalException = class
inherit Exception
Public Class MsalException
Inherits Exception
- Inheritance
-
MsalException
- Derived
Remarks
Avoid throwing this exception. Instead throw the more specialized MsalClientException or MsalServiceException
Constructors
| Name | Description |
|---|---|
| MsalException() |
Initializes a new instance of the exception class. |
| MsalException(String, String, Exception) |
Initializes a new instance of the exception class with a specified error code and a reference to the inner exception that is the cause of this exception. |
| MsalException(String, String) |
Initializes a new instance of the exception class with a specified error code and error message. |
| MsalException(String) |
Initializes a new instance of the exception class with a specified error code. |
Fields
| Name | Description |
|---|---|
| AuthenticationResultMetadataKey |
A key on Data under which MSAL stores the AuthenticationResultMetadata captured when a token acquisition fails with a non-MsalException. Lets downstream consumers surface token-acquisition diagnostics even though the originating exception is re-thrown unchanged. |
| BrokerErrorCode |
An AdditionalExceptionData property key, available when using desktop brokers. |
| BrokerErrorContext |
An AdditionalExceptionData property key, available when using desktop brokers. |
| BrokerErrorStatus |
An AdditionalExceptionData property key, available when using desktop brokers. |
| BrokerErrorTag |
An AdditionalExceptionData property key, available when using desktop brokers. |
| BrokerTelemetry |
An AdditionalExceptionData property key, available when using desktop brokers. |
| ManagedIdentitySource |
An AdditionalExceptionData property key, available when using managed identity. |
Properties
| Name | Description |
|---|---|
| AdditionalExceptionData |
A property bag with extra details for this exception. |
| AuthenticationResultMetadata |
Diagnostic metadata for the failed token-acquisition attempt β the total duration and, when the
relevant stage ran, HTTP/cache durations, token endpoint, and region used. This is
|
| CorrelationId |
An ID that can used to piece up a single authentication flow. |
| ErrorCode |
Gets the protocol error code returned by the service or generated by the client. This is the code you can rely on for exception handling. Values for this code are typically provided in constant strings in the derived exceptions types with explanations of mitigation. |
| IsRetryable |
Indicates if the previous operation that resulted in this exception should be retried. |
Methods
| Name | Description |
|---|---|
| FromJsonString(String) |
Allows re-hydration of the MsalException (or one of its derived types) from JSON generated by ToJsonString(). |
| ToJsonString() |
Allows serialization of most values of the exception into JSON. |
| ToString() |
Creates and returns a string representation of the current exception. |