MsalServiceException Class

public class MsalServiceException
extends MsalException

Exception type thrown when service returns an error response or other networking errors occur.

Constructor Summary

Constructor Description
MsalServiceException(AadInstanceDiscoveryResponse discoveryResponse)

Initializes a new instance of the exception class

MsalServiceException(ErrorResponse errorResponse, Map<String,List<String>> httpHeaders)

Initializes a new instance of the exception class

MsalServiceException(String message, String error)

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

MsalServiceException(String message, String error, ManagedIdentitySourceType managedIdentitySource)

Initializes a new instance of the exception class, with any extra properties for a Managed Identity error

Method Summary

Modifier and Type Method and Description
java.lang.String claims()

Claims included in the claims challenge

java.lang.String correlationId()

An ID that can be used to piece up a single authentication flow.

java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers()

Contains the http headers from the server response that indicated an error.

java.lang.String managedIdentitySource()
java.lang.Integer statusCode()

Status code returned from http layer

java.lang.String statusMessage()

Status message returned from the http layer

Methods inherited from MsalException

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Methods inherited from java.lang.Throwable

java.lang.Throwable.addSuppressed java.lang.Throwable.fillInStackTrace java.lang.Throwable.getCause java.lang.Throwable.getLocalizedMessage java.lang.Throwable.getMessage java.lang.Throwable.getStackTrace java.lang.Throwable.getSuppressed java.lang.Throwable.initCause java.lang.Throwable.printStackTrace java.lang.Throwable.printStackTrace java.lang.Throwable.printStackTrace java.lang.Throwable.setStackTrace java.lang.Throwable.toString

Constructor Details

MsalServiceException

public MsalServiceException(AadInstanceDiscoveryResponse discoveryResponse)

Initializes a new instance of the exception class

Parameters:

discoveryResponse - response object from instance discovery network call

MsalServiceException

public MsalServiceException(ErrorResponse errorResponse, Map> httpHeaders)

Initializes a new instance of the exception class

Parameters:

errorResponse - response object contain information about error returned by server
httpHeaders - http headers from the server response

MsalServiceException

public MsalServiceException(String message, String error)

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

Parameters:

message - the error message that explains the reason for the exception
error - a simplified error code from AuthenticationErrorCode and used for references in documentation

MsalServiceException

public MsalServiceException(String message, String error, ManagedIdentitySourceType managedIdentitySource)

Initializes a new instance of the exception class, with any extra properties for a Managed Identity error

Parameters:

message - the error message that explains the reason for the exception
error
managedIdentitySource - the Managed Identity service

Method Details

claims

public String claims()

Claims included in the claims challenge

correlationId

public String correlationId()

An ID that can be used to piece up a single authentication flow.

headers

public Map> headers()

Contains the http headers from the server response that indicated an error. When the server returns a 429 Too Many Requests error, a Retry-After should be set. It is important to read and respect the time specified in the Retry-After header

managedIdentitySource

public String managedIdentitySource()

statusCode

public Integer statusCode()

Status code returned from http layer

statusMessage

public String statusMessage()

Status message returned from the http layer

Applies to