Setup errors

This commit is contained in:
2023-12-26 15:01:48 -06:00
parent 0b7a459d5b
commit 6202e39fb6

View File

@@ -1 +1,27 @@
package main
import "fmt"
type ChecksumMissingError [32]byte
type ChecksumInvalidError [32]byte
type UnsubscribeRejectedError string
type UnsubscribeUnexpectedError struct {
Message string
Code int
}
func (e ChecksumMissingError) Error() string {
return fmt.Sprintf("checksum missing: %x", e)
}
func (e ChecksumInvalidError) Error() string {
return fmt.Sprintf("checksum invalid: %x", e)
}
func (e UnsubscribeRejectedError) Error() string {
return fmt.Sprintf("rejected: %s", string(e))
}
func (e UnsubscribeUnexpectedError) Error() string {
return fmt.Sprintf("unexpected error: %s", e.Message[:50])
}