@@ -499,36 +499,36 @@ OAuthClient.prototype.makeApiCall = async function makeApiCall({ url, method, he
499
499
detail : err . Detail ,
500
500
code : err . code ,
501
501
element : err . element ,
502
- additionalInfo : err . additionalInfo
502
+ additionalInfo : err . additionalInfo ,
503
503
} ) ) : null ,
504
- timestamp : error . response . data . time
504
+ timestamp : error . response . data . time ,
505
505
} : null ,
506
506
// OAuth error fields
507
507
oauth : {
508
508
error : error . response . data && error . response . data . error ,
509
- error_description : error . response . data && error . response . data . error_description
510
- }
509
+ error_description : error . response . data && error . response . data . error_description ,
510
+ } ,
511
511
} : null ,
512
512
// Request analysis
513
513
request : error . request ? {
514
514
method : error . request . method ,
515
515
path : error . request . path ,
516
- headers : error . request . headers
516
+ headers : error . request . headers ,
517
517
} : null ,
518
518
// Context
519
519
context : {
520
520
attempt,
521
521
url : fullUrl ,
522
- timestamp : new Date ( ) . toISOString ( )
523
- }
522
+ timestamp : new Date ( ) . toISOString ( ) ,
523
+ } ,
524
524
} ;
525
525
526
526
// Log the detailed error analysis
527
527
this . log ( 'error' , 'Exception Analysis:' , {
528
528
hasFaultObject : ! ! ( error . response && error . response . data && error . response . data . Fault ) ,
529
529
faultType : error . response && error . response . data && error . response . data . Fault && error . response . data . Fault . type ,
530
530
faultErrors : error . response && error . response . data && error . response . data . Fault && error . response . data . Fault . Error ,
531
- fullAnalysis : errorAnalysis
531
+ fullAnalysis : errorAnalysis ,
532
532
} ) ;
533
533
534
534
// Log the error for debugging
@@ -571,12 +571,12 @@ OAuthClient.prototype.makeApiCall = async function makeApiCall({ url, method, he
571
571
errors : fault . Error ? fault . Error . map ( err => ( {
572
572
message : err . Message ,
573
573
detail : err . Detail ,
574
- code : err . code
574
+ code : err . code ,
575
575
} ) ) : [ ] ,
576
- time : data . time
576
+ time : data . time ,
577
577
} ,
578
- timestamp : data . time
579
- }
578
+ timestamp : data . time ,
579
+ } ,
580
580
) ;
581
581
}
582
582
@@ -585,7 +585,7 @@ OAuthClient.prototype.makeApiCall = async function makeApiCall({ url, method, he
585
585
( data && data . error ) || 'Bad Request' ,
586
586
'400' ,
587
587
( data && data . error_description ) || 'Request validation failed' ,
588
- intuitTid
588
+ intuitTid ,
589
589
) ;
590
590
}
591
591
@@ -595,7 +595,7 @@ OAuthClient.prototype.makeApiCall = async function makeApiCall({ url, method, he
595
595
'Rate limit exceeded' ,
596
596
'RATE_LIMIT_EXCEEDED' ,
597
597
'Too many requests, please try again later' ,
598
- intuitTid
598
+ intuitTid ,
599
599
) ;
600
600
}
601
601
@@ -604,7 +604,7 @@ OAuthClient.prototype.makeApiCall = async function makeApiCall({ url, method, he
604
604
( data && data . error ) || error . message || 'Unknown error' ,
605
605
status === 500 ? 'INTERNAL_SERVER_ERROR' : status . toString ( ) ,
606
606
( data && data . error_description ) || 'An error occurred during the API call' ,
607
- intuitTid
607
+ intuitTid ,
608
608
) ;
609
609
}
610
610
@@ -613,7 +613,7 @@ OAuthClient.prototype.makeApiCall = async function makeApiCall({ url, method, he
613
613
throw new OAuthError (
614
614
`Request timeout of ${ timeout || 30000 } ms exceeded` ,
615
615
'TIMEOUT_ERROR' ,
616
- 'The request took too long to complete'
616
+ 'The request took too long to complete' ,
617
617
) ;
618
618
}
619
619
@@ -622,15 +622,15 @@ OAuthClient.prototype.makeApiCall = async function makeApiCall({ url, method, he
622
622
throw new OAuthError (
623
623
'Connection reset by peer' ,
624
624
'NETWORK_ERROR' ,
625
- 'A network error occurred while making the request'
625
+ 'A network error occurred while making the request' ,
626
626
) ;
627
627
}
628
628
629
629
// Handle any other errors
630
630
throw new OAuthError (
631
631
error . message || 'Unknown error' ,
632
632
'OAUTH_ERROR' ,
633
- 'An unexpected error occurred'
633
+ 'An unexpected error occurred' ,
634
634
) ;
635
635
}
636
636
@@ -650,15 +650,15 @@ OAuthClient.prototype.makeApiCall = async function makeApiCall({ url, method, he
650
650
throw new OAuthError (
651
651
lastError . message || 'Maximum retry attempts reached' ,
652
652
'MAX_RETRIES_EXCEEDED' ,
653
- 'The request failed after multiple retry attempts'
653
+ 'The request failed after multiple retry attempts' ,
654
654
) ;
655
655
}
656
656
657
657
// This should never be reached, but TypeScript needs it
658
658
throw new OAuthError (
659
659
'Unexpected error in makeApiCall' ,
660
660
'UNKNOWN_ERROR' ,
661
- 'An unexpected error occurred in the API call'
661
+ 'An unexpected error occurred in the API call' ,
662
662
) ;
663
663
} ;
664
664
@@ -843,8 +843,7 @@ OAuthClient.prototype.loadResponse = function loadResponse(request) {
843
843
this . currentRequest = request ;
844
844
let attempt = 0 ;
845
845
846
- const executeRequest = ( ) => {
847
- return axios ( request )
846
+ const executeRequest = ( ) => axios ( request )
848
847
. then ( ( response ) => {
849
848
this . currentRequest = null ;
850
849
return response ;
@@ -871,7 +870,6 @@ OAuthClient.prototype.loadResponse = function loadResponse(request) {
871
870
872
871
throw error ;
873
872
} ) ;
874
- } ;
875
873
876
874
return executeRequest ( ) ;
877
875
} ;
0 commit comments