mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
191690d905
* sdk * fix(sdk): return correct error type * AppendEventError instead of Aggregater error * fix(tests): tests * fix(tests): wantErr to is error func
33 lines
697 B
Go
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
|
|
}
|