Skip to content

Commit edcfc6e

Browse files
committed
Log and error message cleanups 2/2
1 parent 794d918 commit edcfc6e

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/main/java/com/mongodb/kafka/connect/sink/writemodel/strategy/DeleteOneDefaultStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public WriteModel<BsonDocument> createWriteModel(final SinkDocument document) {
5151
.orElseThrow(
5252
() ->
5353
new DataException(
54-
"Cannot build the WriteModel since the key document was missing unexpectedly"));
54+
"Could not build the WriteModel,the key document was missing unexpectedly"));
5555

5656
// NOTE: current design doesn't allow to access original SinkRecord (= null)
5757
BsonDocument deleteFilter;

src/main/java/com/mongodb/kafka/connect/sink/writemodel/strategy/ReplaceOneBusinessKeyStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ public WriteModel<BsonDocument> createWriteModel(final SinkDocument document) {
4343
.orElseThrow(
4444
() ->
4545
new DataException(
46-
"Cannot build the WriteModel since the value document was missing unexpectedly"));
46+
"Could not build the WriteModel,the value document was missing unexpectedly"));
4747

4848
try {
4949
BsonDocument businessKey = vd.getDocument(ID_FIELD);
5050
vd.remove(ID_FIELD);
5151
return new ReplaceOneModel<>(businessKey, vd, REPLACE_OPTIONS);
5252
} catch (BSONException e) {
5353
throw new DataException(
54-
"Cannot build the WriteModel since the value document does not contain an _id field of"
54+
"Could not build the WriteModel,the value document does not contain an _id field of"
5555
+ " type BsonDocument which holds the business key fields.\n\n If you are including an"
5656
+ " existing `_id` value in the business key then ensure `document.id.strategy.overwrite.existing=true`.");
5757
}

src/main/java/com/mongodb/kafka/connect/sink/writemodel/strategy/ReplaceOneDefaultStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public WriteModel<BsonDocument> createWriteModel(final SinkDocument document) {
4242
.orElseThrow(
4343
() ->
4444
new DataException(
45-
"Cannot build the WriteModel since the value document was missing unexpectedly"));
45+
"Could not build the WriteModel,the value document was missing unexpectedly"));
4646

4747
return new ReplaceOneModel<>(new BsonDocument(ID_FIELD, vd.get(ID_FIELD)), vd, REPLACE_OPTIONS);
4848
}

src/main/java/com/mongodb/kafka/connect/sink/writemodel/strategy/UpdateOneBusinessKeyTimestampStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public WriteModel<BsonDocument> createWriteModel(final SinkDocument document) {
4646
.orElseThrow(
4747
() ->
4848
new DataException(
49-
"Cannot build the WriteModel since the value document was missing unexpectedly"));
49+
"Could not build the WriteModel,the value document was missing unexpectedly"));
5050

5151
BsonDateTime dateTime = new BsonDateTime(Instant.now().toEpochMilli());
5252

@@ -62,7 +62,7 @@ public WriteModel<BsonDocument> createWriteModel(final SinkDocument document) {
6262

6363
} catch (BSONException e) {
6464
throw new DataException(
65-
"Cannot build the WriteModel since the value document does not contain an _id field of"
65+
"Could not build the WriteModel,the value document does not contain an _id field of"
6666
+ " type BsonDocument which holds the business key fields.\n\n If you are including an"
6767
+ "existing `_id` value in the business key then ensure `document.id.strategy.overwrite.existing=true`.");
6868
}

src/main/java/com/mongodb/kafka/connect/sink/writemodel/strategy/UpdateOneTimestampsStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public WriteModel<BsonDocument> createWriteModel(final SinkDocument document) {
4646
.orElseThrow(
4747
() ->
4848
new DataException(
49-
"Cannot build the WriteModel since the value document was missing unexpectedly"));
49+
"Could not build the WriteModel,the value document was missing unexpectedly"));
5050

5151
BsonDateTime dateTime = new BsonDateTime(Instant.now().toEpochMilli());
5252

src/main/java/com/mongodb/kafka/connect/source/MongoSourceTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public List<SourceRecord> poll() {
219219

220220
if (topicName.isEmpty()) {
221221
LOGGER.warn(
222-
"No topic set. Cannot publish the message: {}", changeStreamDocument.toJson());
222+
"No topic set. Could not publish the message: {}", changeStreamDocument.toJson());
223223
return sourceRecords;
224224
}
225225

0 commit comments

Comments
 (0)