Skip to content

Commit

Permalink
improve error message for unexpected header (#226)
Browse files Browse the repository at this point in the history
* improve error message for unexpected header

before:
```
expected header (`[B@75c274f1`), but found 12249
```

now:
```
expected header 'FLT GRPH' (`7076843271828072`), but found '1234-97000'
```

* fmt
  • Loading branch information
mpollmeier authored Jul 12, 2024
1 parent 647fc02 commit 7f19081
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/scala/flatgraph/storage/Deserialization.scala
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ object Deserialization {
val headerBytes = new Array[Byte](Keys.Header.length)
header.get(headerBytes)
if (!Arrays.equals(headerBytes, Keys.Header))
throw new DeserializationException(s"expected header (`${Keys.Header}`), but found ${header.getLong}")
throw new DeserializationException(
s"expected header '$MagicBytesString' (`${Keys.Header.mkString("")}`), but found '${headerBytes.mkString("")}'"
)

val manifestOffset = header.getLong()
val manifestSize = channel.size() - manifestOffset
Expand Down

0 comments on commit 7f19081

Please sign in to comment.