Skip to content

Commit

Permalink
feat: log listener operation error
Browse files Browse the repository at this point in the history
  • Loading branch information
acaldas authored and froid1911 committed Mar 29, 2024
1 parent a7b1f5b commit 70e7855
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions api/src/modules/document/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,11 @@ export function getDocumentDriveCRUD(prisma: Prisma.TransactionClient) {
if (!operation) {
throw new Error("Operation couldnt be applied")
}
await driveServer.addDriveOperations(driveId, [operation]);
const result = await driveServer.addDriveOperations(driveId, [operation]);
if (result.status !== "SUCCESS") {
throw new Error(`Listener couldn't be registered: ${result.error}`);
}

return listener;
},

Expand All @@ -235,7 +239,11 @@ export function getDocumentDriveCRUD(prisma: Prisma.TransactionClient) {
throw new Error("Operation couldnt be applied")
}

await driveServer.addDriveOperations(driveId, [operation]);
const result = await driveServer.addDriveOperations(driveId, [operation]);
if (result.status !== "SUCCESS") {
throw new Error(`Listener couldn't be deleted: ${result.error}`);
}

delete transmitters[driveId][listenerId];
return listenerId;
},
Expand Down

0 comments on commit 70e7855

Please sign in to comment.