rishabhdaim commented on code in PR #863:
URL: https://github.com/apache/jackrabbit-oak/pull/863#discussion_r1138136765
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java:
##########
@@ -1055,13 +1064,20 @@ private <T extends Document> T
findAndModify(Collection<T> collection,
Filters.eq(Document.MOD_COUNT, modCount)
);
- UpdateResult result = execute(session -> {
- if (session != null) {
- return dbCollection.updateOne(session, query,
update);
- } else {
- return dbCollection.updateOne(query, update);
- }
- }, collection);
+ UpdateResult result = null;
+ try {
+ result = execute(session -> {
+ if (session != null) {
+ return dbCollection.updateOne(session, query,
update);
+ } else {
+ return dbCollection.updateOne(query, update);
+ }
+ }, collection);
+ } catch (MongoWriteException e) {
+ WriteError error = e.getError();
+ LOG.warn(e.getMessage(), updateOp.getId());
Review Comment:
This would only work with placeholders `{}` not with normal strings.
This would print only the `e.getMessage()` and ignore the `updateOp.getId()`
since it won't find any placeholder for this in `e.getMessage()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]