Skip to content

Commit b080284

Browse files
author
Natalia Chuklina
committed
add codec to DecompressionException
1 parent 52d188e commit b080284

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package tech.ydb.topic.read;
22

3+
import tech.ydb.topic.description.Codec;
4+
35
import java.io.IOException;
46
import java.io.UncheckedIOException;
57

@@ -10,9 +12,11 @@ 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+
public DecompressionException(String message, IOException cause, byte[] rawData, Codec codec) {
1417
super(message, cause);
1518
this.rawData = rawData;
19+
this.codec = codec;
1620
}
1721

1822
/**
@@ -21,4 +25,11 @@ public DecompressionException(String message, IOException cause, byte[] rawData)
2125
public byte[] getRawData() {
2226
return rawData;
2327
}
28+
29+
/**
30+
* @return Codec of message byte data
31+
*/
32+
public Codec getCodec() {
33+
return codec;
34+
}
2435
}

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)