MsalException Class

Definition

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

MsalException()

Initializes a new instance of the exception class.

MsalException(String)

Initializes a new instance of the exception class with a specified error code.

MsalException(String, String)

Initializes a new instance of the exception class with a specified error code and error message.

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.

Properties

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.

Methods

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.

Applies to