Class
This error is thrown when a request encounters an invalid token error. Requests that use ArcGISIdentityManager or
ApplicationCredentialsManager in the authentication option the authentication manager will automatically try to generate
a fresh token using either ArcGISIdentityManager.refreshCredentials or
ApplicationCredentialsManager.refreshCredentials. If the request with the new token fails you will receive an ArcGISAuthError
if refreshing the token fails you will receive an instance of ArcGISTokenRequestError.
request(someUrl, {
authentication: identityManager,
// some additional options...
}).catch(e => {
if(e.name === "ArcGISAuthError") {
console.log("Request with a new token failed you might want to have the user authorize again.")
}
if(e.name === "ArcGISTokenRequestError") {
console.log("There was an error refreshing the token you might want to have the user authorize again.")
}
})Constructors
constructor
Class Constructornew ArcGISAuthError(message: string, code: string | number, response?: any, url?: string, options?: IRequestOptions): ArcGISAuthErrorCreate a new ArcGISAuthError object.
Parameters
| Parameter | Type | Default | Notes |
|---|---|---|---|
message | string | " | The error message from the API |
code | string | number | " | The error code from the API |
response | any | | The original response from the API that caused the error |
url | string | | The original url of the request |
options | IRequestOptions | | The original options of the request |
Returns
ArcGISAuthErrorProperties
| Property | Type | Notes |
|---|---|---|
codeinherited | string | number | The error code returned from the request. |
messageinherited | string | Formatted error message. See the |
nameinherited | string | The name of this error. Will always be |
optionsinherited | IRequestOptions | The options of the original request that caused the error |
originalMessageinherited | string | The errror message return from the request. |
responseinherited | any | The original JSON response the caused the error. |
urlinherited | string | The URL of the original request that caused the error |
code
code: string | numberThe error code returned from the request.
message
message: stringFormatted error message. See the Error class for more details.
name
name: stringThe name of this error. Will always be "ArcGISRequestError" to conform with the Error class.
options
options: IRequestOptionsThe options of the original request that caused the error
originalMessage
originalMessage: stringThe errror message return from the request.
response
response: anyThe original JSON response the caused the error.
url
url: stringThe URL of the original request that caused the error
Methods
| Method | Returns |
|---|---|
retry(getSession, retryLimit) | Promise<unknown> |
retry
Class Methodretry(getSession: IRetryAuthError, retryLimit: number): Promise<unknown>Parameters
| Parameter | Type | Default |
|---|---|---|
get | IRetryAuthError | |
retry | number | 1 |
Returns
Promise<unknown>