Pass TestDecodeMessageBErr

This commit is contained in:
2025-04-25 15:26:12 -04:00
parent 87c4ac8efb
commit 47645a8fce
2 changed files with 6 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package hopp
import "io"
import "net"
import "errors"
import "context"
import "git.tebibyte.media/sashakoshka/hopp/tape"
@@ -148,7 +149,10 @@ func decodeMessageB(
) {
headerBuffer := [10]byte { }
_, err = io.ReadFull(reader, headerBuffer[:])
if err != nil { return 0, 0, nil, err }
if err != nil {
if errors.Is(err, io.EOF) { return 0, 0, nil, io.ErrUnexpectedEOF }
return 0, 0, nil, err
}
method, err = tape.DecodeI16[uint16](headerBuffer[:2])
if err != nil { return 0, 0, nil, err }
length, err := tape.DecodeI64[uint64](headerBuffer[2:10])