src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

error.go (504B)


      1 package eventstream
      2 
      3 import "fmt"
      4 
      5 // LengthError provides the error for items being larger than a maximum length.
      6 type LengthError struct {
      7 	Part  string
      8 	Want  int
      9 	Have  int
     10 	Value any
     11 }
     12 
     13 func (e LengthError) Error() string {
     14 	return fmt.Sprintf("%s length invalid, %d/%d, %v",
     15 		e.Part, e.Want, e.Have, e.Value)
     16 }
     17 
     18 // ChecksumError provides the error for message checksum invalidation errors.
     19 type ChecksumError struct{}
     20 
     21 func (e ChecksumError) Error() string {
     22 	return "message checksum mismatch"
     23 }