feat(exception):增加用于表示参数错误的异常。
This commit is contained in:
parent
20c4398e11
commit
c68d7218a0
19
exceptions/illegal_arguments.go
Normal file
19
exceptions/illegal_arguments.go
Normal 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)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user