Skip to content

Commit 5acef20

Browse files
error checking
1 parent 4fbcc9f commit 5acef20

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

internal/datastore/src/supplier-quotas-repository.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,26 @@ export class SupplierQuotasRepository {
4949
}
5050

5151
async putOverallAllocation(allocation: OverallAllocation): Promise<void> {
52-
await this.ddbClient.send(
53-
new PutCommand({
54-
TableName: this.config.supplierQuotasTableName,
55-
Item: ItemForRecord(
56-
"overall-allocation",
57-
allocation.id,
58-
$OverallAllocation.parse(allocation),
59-
),
60-
}),
61-
);
52+
try {
53+
const parsedAllocation = $OverallAllocation.parse(allocation);
54+
await this.ddbClient.send(
55+
new PutCommand({
56+
TableName: this.config.supplierQuotasTableName,
57+
Item: ItemForRecord(
58+
"overall-allocation",
59+
allocation.id,
60+
parsedAllocation,
61+
),
62+
}),
63+
);
64+
} catch (error) {
65+
if (error instanceof Error) {
66+
throw new Error(
67+
`Failed to put overall allocation for id ${allocation.id}: ${error.message}`,
68+
);
69+
}
70+
throw error;
71+
}
6272
}
6373

6474
// Update the overallAllocation table updating the allocations array for a given volume group

0 commit comments

Comments
 (0)