Skip to content

Commit

Permalink
Add try catch for header fields encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Tideman committed Oct 23, 2024
1 parent 476dbda commit 33bdfc7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/lib/stores/schedules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,18 @@ export const submitEditSchedule = async (

const fields = body.schedule.action.startWorkflow?.header?.fields;
if (fields && Object.keys(fields).length > 0) {
const entries = Object.entries(fields);
for (const [key, value] of entries) {
const encodedValue = await encodePayloads(
stringifyWithBigInt(value),
'json/plain',
);
fields[key] = encodedValue[0];
try {
const entries = Object.entries(fields);
for (const [key, value] of entries) {
const encodedValue = await encodePayloads(
stringifyWithBigInt(value),
'json/plain',
);
fields[key] = encodedValue[0];
}
} catch (e) {
error.set(`${translate('data-encoder.encode-error')}: ${e?.message}`);
return;
}
}

Expand Down

0 comments on commit 33bdfc7

Please sign in to comment.