Skip to content

Commit

Permalink
Fix(SCIMMY.Messages.BulkRequest): uncaught promise rejection in faile…
Browse files Browse the repository at this point in the history
…d bulk operations
  • Loading branch information
sleelin committed Apr 21, 2024
1 parent 30ad0b4 commit ae870a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/messages/bulkrequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export class BulkRequest {
}

// Get ready
const resource = new TargetResource(data?.id ?? id);
const resource = new TargetResource(method.toUpperCase() === "POST" ? undefined : id ?? data?.id);
let value;

// Do the thing!
Expand Down Expand Up @@ -257,7 +257,10 @@ export class BulkRequest {
errorCount++;

// Also reject the pending bulkId promise as no resource ID can exist
if (bulkId && bulkIds.has(bulkId)) bulkIds.get(bulkId).reject(error);
if (bulkId && bulkIds.has(bulkId)) {
bulkIds.get(bulkId).reject(error);
bulkIds.get(bulkId).catch(() => {});
}
}

return result;
Expand Down

0 comments on commit ae870a3

Please sign in to comment.