Esri/arcgis-rest-js

CompleteOAuth2 does not catch license type error

Open

#1,080 opened on Mar 1, 2023

 (0 comments) (0 reactions) (1 assignee)TypeScript (126 forks)auto 404
help wanted

Repository metrics

Stars
 (389 stars)
PR merge metrics
 (PR metrics pending)

Description

Describe the bug

When calling completeOAuth2, I cannot catch the error that occurs when a user does not have a sufficient user license. This makes it impossible for me to handle this error and I am not sure why the error is breaking out of the try catch

Reproduction

try {
    const res = ArcGISIdentityManager.completeOAuth2(JSON.parse(opts));
} catch {
    console.log('Error not being caught');
}

Logs

ArcGISIdentityManager.ts:472 Uncaught (in promise) 
ArcGISAuthError: invalid_request: You do not have a sufficient user license type to access this application.
    at win.addEventListener.once (ArcGISIdentityManager.ts:472:31)
    at reportError (chunk-MWYRUQLI.js:924:20)
    at ArcGISIdentityManager.completeOAuth2 (chunk-MWYRUQLI.js:975:14)
    at Authenticate.tsx:28:41

System Info

Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.13.0/bin/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
  Browsers:
    Chrome: 110.0.5481.177
    Firefox: 109.0.1
  npmPackages:
    @esri/arcgis-rest-request: ^4.1.1 => 4.1.1

Additional Information

No response

Contributor guide