File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1
- import { MongoAWSError , MongoMissingCredentialsError } from '../../../error' ;
1
+ import { MongoAzureError } from '../../../error' ;
2
2
import { request } from '../../../utils' ;
3
3
import { AzureTokenCache } from './azure_token_cache' ;
4
4
import { ServiceWorkflow } from './service_workflow' ;
@@ -51,7 +51,7 @@ export class AzureServiceWorkflow extends ServiceWorkflow {
51
51
async getToken ( ) : Promise < string > {
52
52
const tokenAudience = process . env . TOKEN_AUDIENCE ;
53
53
if ( ! tokenAudience ) {
54
- throw new MongoAWSError ( TOKEN_AUDIENCE_MISSING_ERROR ) ;
54
+ throw new MongoAzureError ( TOKEN_AUDIENCE_MISSING_ERROR ) ;
55
55
}
56
56
let token ;
57
57
const entry = this . cache . getEntry ( tokenAudience ) ;
@@ -66,7 +66,7 @@ export class AzureServiceWorkflow extends ServiceWorkflow {
66
66
67
67
if ( isEndpointResultInvalid ( token ) ) {
68
68
this . cache . deleteEntry ( tokenAudience ) ;
69
- throw new MongoMissingCredentialsError ( ENDPOINT_RESULT_ERROR ) ;
69
+ throw new MongoAzureError ( ENDPOINT_RESULT_ERROR ) ;
70
70
}
71
71
return token ;
72
72
}
Original file line number Diff line number Diff line change @@ -373,6 +373,23 @@ export class MongoAWSError extends MongoRuntimeError {
373
373
}
374
374
}
375
375
376
+ /**
377
+ * A error generated when the user attempts to authenticate
378
+ * via Azure, but fails.
379
+ *
380
+ * @public
381
+ * @category Error
382
+ */
383
+ export class MongoAzureError extends MongoRuntimeError {
384
+ constructor ( message : string ) {
385
+ super ( message ) ;
386
+ }
387
+
388
+ override get name ( ) : string {
389
+ return 'MongoAzureError' ;
390
+ }
391
+ }
392
+
376
393
/**
377
394
* An error generated when a ChangeStream operation fails to execute.
378
395
*
You can’t perform that action at this time.
0 commit comments