File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
document-store/src/main/java/org/hypertrace/core/documentstore/mongo Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -558,7 +558,28 @@ public Optional<Document> update(
558558 final java .util .Collection <SubDocumentUpdate > updates ,
559559 final org .hypertrace .core .documentstore .model .options .UpdateOptions updateOptions )
560560 throws IOException {
561- return updateExecutor .update (query , updates , updateOptions );
561+ try {
562+ return updateExecutor .update (query , updates , updateOptions );
563+ } catch (final MongoWriteException e ) {
564+ if (e .getCode () == MONGODB_DUPLICATE_KEY_ERROR_CODE ) {
565+ throw new DuplicateDocumentException ();
566+ }
567+ LOGGER .error (
568+ "Exception updating document(s). query: {} updates:{} options:{}" ,
569+ query ,
570+ updates ,
571+ updateOptions ,
572+ e );
573+ throw new IOException (e );
574+ } catch (final Exception e ) {
575+ LOGGER .error (
576+ "Exception updating document(s). query: {} updates:{} options:{}" ,
577+ query ,
578+ updates ,
579+ updateOptions ,
580+ e );
581+ throw new IOException (e );
582+ }
562583 }
563584
564585 @ Override
You can’t perform that action at this time.
0 commit comments