Files
scla-unsubscribe/errors.go
2023-12-26 15:10:06 -06:00

28 lines
640 B
Go

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", []byte(e[:]))
}
func (e ChecksumInvalidError) Error() string {
return fmt.Sprintf("checksum invalid: %x", []byte(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])
}