Class
This error is thrown when a request encounters an invalid token error. Requests that use ArcGISIdentityManager
orApplicationCredentialsManager
in the authentication
option the authentication manager will automatically try to generate
a fresh token using either ArcGISIdentityManager.refreshCredentials
orApplicationCredentialsManager.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): ArcGISAuthError
Create a new ArcGISAuthError
object.
Parameters
Parameter | Type | Default | Notes |
---|---|---|---|
message | string | "AUTHENTICATION_ | The error message from the API |
code | string | number | "AUTHENTICATION_ | 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
ArcGISAuthError
Properties
Property | Type | Notes |
---|---|---|
code inherited | string | number | The error code returned from the request. |
message inherited | string | Formatted error message. See the |
name inherited | string | The name of this error. Will always be |
options inherited | The options of the original request that caused the error | |
originalMessage inherited | string | The errror message return from the request. |
response inherited | any | The original JSON response the caused the error. |
url inherited | string | The URL of the original request that caused the error |
message
message: string
Formatted error message. See the Error
class for more details.
name
name: string
The name of this error. Will always be "ArcGISRequestError"
to conform with the Error
class.
options
options: IRequestOptions
The options of the original request that caused the error
originalMessage
originalMessage: string
The errror message return from the request.
response
response: any
The original JSON response the caused the error.
url
url: string
The 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>
code: string | number
The error code returned from the request.