17 lines
437 B
Go
17 lines
437 B
Go
package binarystr
|
|
|
|
import (
|
|
`fmt`
|
|
)
|
|
|
|
// Error conforms a [BadReadErr] to an [error].
|
|
func (b *BadReadErr) Error() (err string) {
|
|
|
|
err = fmt.Sprintf("only read %d bytes from internal read source before encountering a read error", b.numBytes)
|
|
|
|
return
|
|
}
|
|
|
|
// NumBytesRead returns the number of bytes read (BEFORE mutation/encoding/decoding) before the error was hit.
|
|
func (b *BadReadErr) NumBytesRead() (u64 uint64) { return b.numBytes }
|