File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
packages/contentstack-utilities/src Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ class AuthenticationHandler {
52
52
}
53
53
54
54
async refreshAccessToken ( error : any , maxRetryCount = 1 ) : Promise < void > {
55
+ // Add configurable delay only for CI/CD pipelines
56
+ const delayMs = process . env . DELAY_MS ;
57
+
58
+ if ( delayMs ) {
59
+ const delay = parseInt ( delayMs , 10 ) ;
60
+ await new Promise ( ( resolve ) => setTimeout ( resolve , delay ) ) ;
61
+ }
55
62
if ( error . response && error . response . status ) {
56
63
switch ( error . response . status ) {
57
64
case 401 :
Original file line number Diff line number Diff line change @@ -48,11 +48,12 @@ const cliErrorHandler = new CLIErrorHandler(); // Enable debug mode for error cl
48
48
*/
49
49
function handleAndLogError ( error : unknown , context ?: ErrorContext , errorMessage ?: string ) : void {
50
50
const classified = cliErrorHandler . classifyError ( error , context , errorMessage ) ;
51
+ const apiError = classified . error ?. message || classified ?. message || 'Unknown error' ;
51
52
52
53
// Always log the error
53
54
v2Logger . logError ( {
54
55
type : classified . type ,
55
- message : errorMessage || classified . error ?. message || classified . message ,
56
+ message : errorMessage ? ` ${ errorMessage } \nAPI Error: ${ apiError } ` : ` ${ apiError } ` ,
56
57
error : classified . error ,
57
58
context : typeof classified . context === 'string' ? { message : classified . context } : classified . context ,
58
59
hidden : classified . hidden ,
You can’t perform that action at this time.
0 commit comments