Skip to content

Commit 9eb4f42

Browse files
authored
Merge pull request #383 from Natal1a-Chuklina/add-codec-to-decompression-exception
add codec to DecompressionException
2 parents 52d188e + c9e4968 commit 9eb4f42

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

topic/src/main/java/tech/ydb/topic/read/DecompressionException.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
import java.io.IOException;
44
import java.io.UncheckedIOException;
55

6+
import tech.ydb.topic.description.Codec;
7+
68
/**
79
* @author Nikolay Perfilov
810
*/
911
public class DecompressionException extends UncheckedIOException {
1012
private static final long serialVersionUID = 2720187645859527813L;
1113

1214
private final byte[] rawData;
13-
public DecompressionException(String message, IOException cause, byte[] rawData) {
15+
private final Codec codec;
16+
17+
public DecompressionException(String message, IOException cause, byte[] rawData, Codec codec) {
1418
super(message, cause);
1519
this.rawData = rawData;
20+
this.codec = codec;
1621
}
1722

1823
/**
@@ -21,4 +26,11 @@ public DecompressionException(String message, IOException cause, byte[] rawData)
2126
public byte[] getRawData() {
2227
return rawData;
2328
}
29+
30+
/**
31+
* @return Codec of message byte data
32+
*/
33+
public Codec getCodec() {
34+
return codec;
35+
}
2436
}

topic/src/main/java/tech/ydb/topic/read/impl/MessageImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private MessageImpl(Builder builder) {
5050
public byte[] getData() {
5151
if (exception != null) {
5252
throw new DecompressionException("Error occurred while decoding a message",
53-
exception, data);
53+
exception, data, batchMeta.getCodec());
5454
}
5555
return data;
5656
}

0 commit comments

Comments
 (0)