feat(bsr): improve error handling
This commit is contained in:
1 parent
4488f5f8cd
commit
e29b844131
4 files changed
+57
-16
No files matched your search
@@ -72,7 +72,10 @@ func (e ChunkEncoder) Encode(ctx context.Context, c Chunk) (int, error) {
|
||||
if _, err := compressor.Write(data); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
compressor.Close()
|
||||
err = compressor.Close()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
length := buf.Len()
|
||||
|
||||
t := c.GetTimestamp().marshal()
|
||||
@@ -86,7 +89,10 @@ func (e ChunkEncoder) Encode(ctx context.Context, c Chunk) (int, error) {
|
||||
crced = append(crced, buf.Bytes()...)
|
||||
|
||||
crc := crc32.NewIEEE()
|
||||
crc.Write(crced)
|
||||
_, err = crc.Write(crced)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
d := make([]byte, 0, chunkBaseSize+length+crcSize)
|
||||
d = binary.BigEndian.AppendUint32(d, uint32(length))
|
||||
|
||||
Reference in new issue
Block a user