Skip to content

Commit

Permalink
fix: duplicate project error issue
Browse files Browse the repository at this point in the history
  • Loading branch information
aman19K committed Sep 25, 2024
1 parent bfbc0aa commit 8a76cbe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/contentstack-variants/src/utils/error-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ export function formatErrors(errors: any): string {
for (const errorKey in errors) {
const errorValue = errors[errorKey];
if (Array.isArray(errorValue)) {
errorMessages.push(...errorValue.map((error: any) => formatError(errorKey, error)));
errorMessages.push(...errorValue.map((error: any) => formatError(error)));
} else {
errorMessages.push(formatError(errorKey, errorValue));
errorMessages.push(formatError(errorValue));
}
}

return errorMessages.join(' ');
}

function formatError(errorKey: string, error: any): string {
function formatError(error: any): string {
if (typeof error === 'object') {
return `${errorKey}: ${Object.values(error).join(' ')}`;
return Object.values(error).join(' ');
}
return `${errorKey}: ${error}`;
return error;
}

0 comments on commit 8a76cbe

Please sign in to comment.