Skip to content

Commit

Permalink
update error msg
Browse files Browse the repository at this point in the history
Signed-off-by: LiangliangSui <coolsui.coding@gmail.com>
  • Loading branch information
LiangliangSui committed Apr 19, 2024
1 parent 7604e6e commit d35ee0e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions go/fury/fury.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,10 @@ func (f *Fury) Deserialize(buf *ByteBuffer, v interface{}, buffers []*ByteBuffer
if f.language == XLANG {
magicNumber := buf.ReadInt16()
if magicNumber != MAGIC_NUMBER {
return fmt.Errorf("the XLANG cross-language protocol is not currently used. For details," +
"see https://github.com/apache/incubator-fury/blob/main/docs/specification/xlang_serialization_spec.md")
return fmt.Errorf(
"the fury xlang serialization must start with magic number 0x%x. "+
"Please check whether the serialization is based on the xlang protocol and the data didn't corrupt",
MAGIC_NUMBER)
}
} else {
return fmt.Errorf("%d language is not supported", f.language)
Expand Down
6 changes: 4 additions & 2 deletions java/fury-core/src/main/java/org/apache/fury/Fury.java
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,10 @@ public Object deserialize(MemoryBuffer buffer, Iterable<MemoryBuffer> outOfBandB
if (language == Language.XLANG) {
short magicNumber = buffer.readInt16();
assert magicNumber == MAGIC_NUMBER
: "The XLANG cross-language protocol is not currently used. For details, "
+ "see https://github.com/apache/incubator-fury/blob/main/docs/specification/xlang_serialization_spec.md.";
: String.format(
"The fury xlang serialization must start with magic number 0x%x. Please "
+ "check whether the serialization is based on the xlang protocol and the data didn't corrupt.",
MAGIC_NUMBER);
}
byte bitmap = buffer.readByte();
if ((bitmap & isNilFlag) == isNilFlag) {
Expand Down
4 changes: 2 additions & 2 deletions python/pyfury/_fury.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,8 @@ def _deserialize(
if self.language == Language.XLANG:
magic_numer = buffer.read_int16()
assert magic_numer == MAGIC_NUMBER, (
"The XLANG cross-language protocol is not currently used. For details,"
"see https://github.com/apache/incubator-fury/blob/main/docs/specification/xlang_serialization_spec.md"
f"The fury xlang serialization must start with magic number {hex(MAGIC_NUMBER)}. "
"Please check whether the serialization is based on the xlang protocol and the data didn't corrupt."
)
reader_index = buffer.reader_index
buffer.reader_index = reader_index + 1
Expand Down
6 changes: 4 additions & 2 deletions python/pyfury/_serialization.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1064,8 +1064,10 @@ cdef class Fury:
if self.language == Language.XLANG:
magic_numer = buffer.read_int16()
assert magic_numer == MAGIC_NUMBER, (
"The XLANG cross-language protocol is not currently used. For details, see "
"https://github.com/apache/incubator-fury/blob/main/docs/specification/xlang_serialization_spec.md.")
f"The fury xlang serialization must start with magic number {hex(MAGIC_NUMBER)}. "
"Please check whether the serialization is based on the xlang protocol and the "
"data didn't corrupt."
)
cdef int32_t reader_index = buffer.reader_index
buffer.reader_index = reader_index + 1
if get_bit(buffer, reader_index, 0):
Expand Down

0 comments on commit d35ee0e

Please sign in to comment.