Skip to content

Commit

Permalink
logs for checkpoint upsert failure (microsoft#19440)
Browse files Browse the repository at this point in the history
Adds additional logs for checkpoint upsert failure
  • Loading branch information
kekachmar authored Feb 2, 2024
1 parent 1d2c739 commit a9b7481
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,25 @@ export class MongoCheckpointRepository implements ICheckpointRepository {
return;
}
const pointReadFilter = this.composePointReadFilter(documentId, tenantId);
await this.collection.upsert(
pointReadFilter,
{ [this.checkpointType]: JSON.stringify(checkpoint) },
null,
);
try {
await this.collection.upsert(
pointReadFilter,
{ [this.checkpointType]: JSON.stringify(checkpoint) },
null,
);
} catch (error: any) {
const err = new Error(`Checkpoint upsert error: ${error.message?.substring(0, 30)}`);
Lumberjack.error(
"Unexpected error when writing checkpoint",
{
...getLumberBaseProperties(documentId, tenantId),
pointReadFilter,
checkpointType: this.checkpointType,
},
err,
);
throw error;
}
}

async removeServiceCheckpoint(documentId, tenantId): Promise<void> {
Expand Down

0 comments on commit a9b7481

Please sign in to comment.