File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -244,8 +244,17 @@ export class Controller {
244
244
}
245
245
246
246
if ( this . adapter . getToken && req . providerConfig ) {
247
- const { apiKey } = await this . adapter . getToken ( req . providerConfig ) ;
248
- res . header ( 'X-Provider-Key' , apiKey ) ;
247
+ try {
248
+ const { apiKey } = await this . adapter . getToken ( req . providerConfig ) ;
249
+ res . header ( 'X-Provider-Key' , apiKey ) ;
250
+ } catch ( error ) {
251
+ errorLogger (
252
+ 'getContacts' ,
253
+ 'Could not get and refresh token' ,
254
+ providerConfig . apiKey ,
255
+ error ,
256
+ ) ;
257
+ }
249
258
}
250
259
251
260
infoLogger ( 'getContacts' , 'END' , providerConfig . apiKey ) ;
@@ -374,8 +383,17 @@ export class Controller {
374
383
this . streamingPromises . set ( `${ userId } :${ timestamp } ` , streamingPromise ) ;
375
384
376
385
if ( this . adapter . getToken && req . providerConfig ) {
377
- const { apiKey } = await this . adapter . getToken ( req . providerConfig ) ;
378
- res . header ( 'X-Provider-Key' , apiKey ) ;
386
+ try {
387
+ const { apiKey } = await this . adapter . getToken ( req . providerConfig ) ;
388
+ res . header ( 'X-Provider-Key' , apiKey ) ;
389
+ } catch ( error ) {
390
+ errorLogger (
391
+ 'streamContacts' ,
392
+ 'Could not get and refresh token' ,
393
+ providerConfig . apiKey ,
394
+ error ,
395
+ ) ;
396
+ }
379
397
}
380
398
381
399
infoLogger ( 'streamContacts' , 'END' , providerConfig . apiKey ) ;
You can’t perform that action at this time.
0 commit comments