enhance(error):增加两个工具异常。
This commit is contained in:
parent
7531d37e5a
commit
8dd9654d82
13
exceptions/not_found.go
Normal file
13
exceptions/not_found.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package exceptions
|
||||
|
||||
type NotFoundError struct {
|
||||
Message string
|
||||
}
|
||||
|
||||
func NewNotFoundError(msg string) *NotFoundError {
|
||||
return &NotFoundError{Message: msg}
|
||||
}
|
||||
|
||||
func (e NotFoundError) Error() string {
|
||||
return e.Message
|
||||
}
|
11
exceptions/unsuccessful.go
Normal file
11
exceptions/unsuccessful.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package exceptions
|
||||
|
||||
type UnsuccessfulOperationError struct{}
|
||||
|
||||
func NewUnsuccessfulOperationError() *UnsuccessfulOperationError {
|
||||
return &UnsuccessfulOperationError{}
|
||||
}
|
||||
|
||||
func (UnsuccessfulOperationError) Error() string {
|
||||
return "Unsuccessful Operation"
|
||||
}
|
Loading…
Reference in New Issue
Block a user