feat(exception):增加用于表示参数错误的异常。

This commit is contained in:
徐涛 2022-08-16 00:03:01 +08:00
parent 20c4398e11
commit c68d7218a0

View File

@ -0,0 +1,19 @@
package exceptions
import "fmt"
type IllegalArgumentsError struct {
Message string
Arguments []string
}
func NewIllegalArgumentsError(msg string, arguments ...string) IllegalArgumentsError {
return IllegalArgumentsError{
Message: msg,
Arguments: arguments,
}
}
func (e IllegalArgumentsError) Error() string {
return fmt.Sprintf("Illegal Arguments, %s", e.Message)
}