Skip to content

added a delay to check failing test cases #2002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 30, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ class AuthenticationHandler {
}

async refreshAccessToken(error: any, maxRetryCount = 1): Promise<void> {
// Add configurable delay only for CI/CD pipelines
const delayMs = process.env.DELAY_MS;

if (delayMs) {
const delay = parseInt(delayMs, 10);
await new Promise((resolve) => setTimeout(resolve, delay));
}
if (error.response && error.response.status) {
switch (error.response.status) {
case 401:
Expand Down
3 changes: 2 additions & 1 deletion packages/contentstack-utilities/src/logger/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ const cliErrorHandler = new CLIErrorHandler(); // Enable debug mode for error cl
*/
function handleAndLogError(error: unknown, context?: ErrorContext, errorMessage?: string): void {
const classified = cliErrorHandler.classifyError(error, context, errorMessage);
const apiError = classified.error?.message || classified?.message || 'Unknown error';

// Always log the error
v2Logger.logError({
type: classified.type,
message: errorMessage || classified.error?.message || classified.message,
message: errorMessage ? `${errorMessage}\nAPI Error: ${apiError}` : `${apiError}`,
error: classified.error,
context: typeof classified.context === 'string' ? { message: classified.context } : classified.context,
hidden: classified.hidden,
Expand Down
Loading