2024-02-24 21:00:04 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
const (
|
|
|
|
pkgName = "models"
|
|
|
|
|
|
|
|
ErrAccountInvalidUsername ValidatorError = "invalid account username"
|
|
|
|
ErrAccountInvalidID ValidatorError = "invalid account id"
|
2024-03-20 16:36:45 +00:00
|
|
|
|
|
|
|
ErrChannelInvalidAccountID ValidatorError = "invalid channel account id"
|
|
|
|
ErrChannelInvalidApiKey ValidatorError = "invalid channel API key"
|
|
|
|
ErrChannelInvalidCID ValidatorError = "invalid channel CID"
|
|
|
|
ErrChannelInvalidName ValidatorError = "invalid channel name"
|
2024-02-24 21:00:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func pkgErr(prefix string, err error) error {
|
|
|
|
pkgErr := pkgName
|
|
|
|
if prefix != "" {
|
|
|
|
pkgErr = fmt.Sprintf("%s: %s", pkgErr, prefix)
|
|
|
|
}
|
|
|
|
|
|
|
|
return fmt.Errorf("%s: %v", pkgErr, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
type ValidatorError string
|
|
|
|
|
|
|
|
func (e ValidatorError) Error() string {
|
|
|
|
return string(e)
|
|
|
|
}
|