ArcGISAuthError

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 ArcGISAuthErrorif refreshing the token fails you will receive an instance of ArcGISTokenRequestError.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
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.")
  }
})
Inheritance: ArcGISAuthErrorArcGISRequestError

Constructors

constructor

Class Constructor
new ArcGISAuthError(messagestring, codestring | number, response?any, url?string, options?IRequestOptions): ArcGISAuthError

Create a new ArcGISAuthError object.

Parameters
ParameterTypeDefaultNotes
message
string
"AUTHENTICATION_ERROR"

The error message from the API

code
string | number
"AUTHENTICATION_ERROR_CODE"

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

Hide inherited properties
PropertyTypeNotes
code
inherited
string | number

The error code returned from the request.

message
inherited
string

Formatted error message. See the Error class for more details.

name
inherited
string

The name of this error. Will always be "ArcGISRequestError" to conform with the Error class.

options
inherited

The options of the original request that caused the error

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

code

inherited
Class Property
code: string | number

The error code returned from the request.

message

inherited
Class Property
message: string

Formatted error message. See the Error class for more details.

name

inherited
Class Property
name: string

The name of this error. Will always be "ArcGISRequestError" to conform with the Error class.

options

inherited
Class Property
options: IRequestOptions

The options of the original request that caused the error

originalMessage

inherited
Class Property
originalMessage: string

The errror message return from the request.

response

inherited
Class Property
response: any

The original JSON response the caused the error.

url

inherited
Class Property
url: string

The URL of the original request that caused the error

Inherited from ArcGISRequestError.url

Methods

MethodReturns
retry(getSession, retryLimit)
Promise<unknown>

retry

Class Method
retry(getSessionIRetryAuthError, retryLimitnumber): Promise<unknown>
Parameters
ParameterTypeDefault
getSession
IRetryAuthError
retryLimit
number
1
Returns 
Promise<unknown>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.