zitadel/internal/errors/invalid_argument.go
Silvan 191690d905
feat(eventstore): sdk (#39)
* sdk

* fix(sdk): return correct error type

* AppendEventError instead of Aggregater error

* fix(tests): tests

* fix(tests): wantErr to is error func
2020-04-07 18:36:37 +02:00

33 lines
697 B
Go

package errors
import "fmt"
var (
_ InvalidArgument = (*InvalidArgumentError)(nil)
_ Error = (*InvalidArgumentError)(nil)
)
type InvalidArgument interface {
error
IsInvalidArgument()
}
type InvalidArgumentError struct {
*CaosError
}
func ThrowInvalidArgument(parent error, id, message string) error {
return &InvalidArgumentError{CreateCaosError(parent, id, message)}
}
func ThrowInvalidArgumentf(parent error, id, format string, a ...interface{}) error {
return ThrowInvalidArgument(parent, id, fmt.Sprintf(format, a...))
}
func (err *InvalidArgumentError) IsInvalidArgument() {}
func IsErrorInvalidArgument(err error) bool {
_, ok := err.(InvalidArgument)
return ok
}