Skip to content

Commit

Permalink
fix(api): more informative console log errors from try catch (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsonsj authored Oct 22, 2024
1 parent 55378ad commit 03cf7b4
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 4 deletions.
13 changes: 13 additions & 0 deletions plugin/src/lib/api/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,19 @@ export async function updatePayloadTranslation({
...translations
};
} catch (error) {
console.log(
'updatePayloadTranslation',
{
articleDirectoryId,
pluginOptions,
payload,
draft,
dryRun,
excludeLocales,
},
'error',
error
)
return {
status: 400,
error,
Expand Down
54 changes: 50 additions & 4 deletions plugin/src/lib/api/payload-crowdin-sync/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,19 @@ export class payloadCrowdinSyncTranslationsApi {
},
});
} catch (error) {
console.log(error);
console.log(
'updateTranslation',
{
documentId,
collection,
dryRun,
global,
draft,
excludeLocales,
},
'error',
error
);
}
} else {
try {
Expand All @@ -172,7 +184,19 @@ export class payloadCrowdinSyncTranslationsApi {
data: report[locale].latestTranslations,
});
} catch (error) {
console.log(error);
console.log(
'updateTranslation',
{
documentId,
collection,
dryRun,
global,
draft,
excludeLocales,
},
'error',
error
);
}
}
}
Expand Down Expand Up @@ -250,7 +274,17 @@ export class payloadCrowdinSyncTranslationsApi {
});
return docTranslations;
} catch (error) {
console.log(error);
console.log(
'getCurrentDocumentTranslation',
{
doc,
collection,
locale,
global,
},
'error',
error
);
throw new Error(`${error}`);
}
}
Expand Down Expand Up @@ -420,7 +454,19 @@ export class payloadCrowdinSyncTranslationsApi {
return JSON.parse(data);
}
} catch (error) {
console.log(error);
console.log(
'getTranslation',
{
documentId,
fieldName,
locale,
collection,
parentCrowdinArticleDirectoryId,
fields
},
'error',
error
);
}
}

Expand Down

0 comments on commit 03cf7b4

Please sign in to comment.