MsalServiceException Class
- java.
lang. Object - BaseException
- MsalException
- com.
microsoft. identity. client. exception. MsalServiceException
- com.
public class MsalServiceException extends MsalException
This exception class represents errors when communicating to the service, can be from the authorize or token endpoints. MSAL reads the error and error_description from the server response. Generally, these errors are resolved by fixing app configurations either in code or in the app registration portal.
Set of error codes that could be returned from this exception:
invalid_request: This request is missing a required parameter, includes an invalid parameter, includes a parameter more than once, or is otherwise malformed.
unauthorized_client: The client is not authorized to request an authorization code.
access_denied: The resource owner or authorization server denied the request.
invalid_scope: The request scope is invalid, unknown or malformed.
service_not_available: Represents 500/503/504 error codes.
request_timeout: Represents java.net.SocketTimeoutException.
invalid_instance: AuthorityMetadata validation failed.
unknown_error: Request to server failed, but no error and error_description was returned from the service.
Note: MsalServiceException provides one extra API:
<li>
<p>
<xref uid="com.microsoft.identity.client.exception.MsalServiceException.getHttpStatusCode()" data-throw-if-not-resolved="false" data-raw-source="MsalServiceException#getHttpStatusCode()"></xref> : indicates the http status code for the failed request. </p>
</li>
Field Summary
Modifier and Type | Field and Description |
---|---|
final String |
ACCESS_DENIED
The resource owner or authorization server denied the request. |
final int |
DEFAULT_STATUS_CODE
When java.net.SocketTimeoutException is thrown, no status code will be caught. Will use 0 instead. |
final String |
INVALID_INSTANCE
AuthorityMetadata validation failed. |
final String |
INVALID_REQUEST
This request is missing a required parameter, includes an invalid parameter, includes a parameter more than once, or is otherwise malformed. |
final String |
INVALID_SCOPE
The request scope is invalid, unknown or malformed. |
final String |
REQUEST_TIMEOUT
Represents java.net.SocketTimeoutException. |
final String |
SERVICE_NOT_AVAILABLE
Represents 500/503/504 error codes. |
final String |
UNAUTHORIZED_CLIENT
The client is not authorized to request an authorization code. |
final String |
UNKNOWN_ERROR
Request to server failed, but no error and error_description is returned back from the service. |
Constructor Summary
Method Summary
Modifier and Type | Method and Description |
---|---|
int | getHttpStatusCode() |
Inherited Members
Field Details
ACCESS_DENIED
public static final String ACCESS_DENIED= ServiceException.ACCESS_DENIED
The resource owner or authorization server denied the request.
DEFAULT_STATUS_CODE
public static final int DEFAULT_STATUS_CODE= 0
When java.net.SocketTimeoutException is thrown, no status code will be caught. Will use 0 instead.
INVALID_INSTANCE
public static final String INVALID_INSTANCE= ServiceException.INVALID_INSTANCE
AuthorityMetadata validation failed.
INVALID_REQUEST
public static final String INVALID_REQUEST= ServiceException.INVALID_REQUEST
This request is missing a required parameter, includes an invalid parameter, includes a parameter more than once, or is otherwise malformed.
INVALID_SCOPE
public static final String INVALID_SCOPE= ServiceException.INVALID_SCOPE
The request scope is invalid, unknown or malformed.
REQUEST_TIMEOUT
public static final String REQUEST_TIMEOUT= ServiceException.REQUEST_TIMEOUT
Represents java.net.SocketTimeoutException.
SERVICE_NOT_AVAILABLE
public static final String SERVICE_NOT_AVAILABLE= ServiceException.SERVICE_NOT_AVAILABLE
Represents 500/503/504 error codes.
UNAUTHORIZED_CLIENT
public static final String UNAUTHORIZED_CLIENT= ServiceException.UNAUTHORIZED_CLIENT
The client is not authorized to request an authorization code.
UNKNOWN_ERROR
public static final String UNKNOWN_ERROR= ServiceException.UNKNOWN_ERROR
Request to server failed, but no error and error_description is returned back from the service.
Constructor Details
MsalServiceException
public MsalServiceException(final String errorCode, final String errorMessage, final int httpStatusCode, final Throwable throwable)
Parameters:
MsalServiceException
public MsalServiceException(final String errorCode, final String errorMessage, final Throwable throwable)
Parameters:
Method Details
getHttpStatusCode
public int getHttpStatusCode()
Returns:
Applies to
Azure SDK for Java