enhance(error):增加两个工具异常。

This commit is contained in:
徐涛 2022-08-12 11:40:21 +08:00
parent 7531d37e5a
commit 8dd9654d82
2 changed files with 24 additions and 0 deletions

13
exceptions/not_found.go Normal file
View 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
}

View File

@ -0,0 +1,11 @@
package exceptions
type UnsuccessfulOperationError struct{}
func NewUnsuccessfulOperationError() *UnsuccessfulOperationError {
return &UnsuccessfulOperationError{}
}
func (UnsuccessfulOperationError) Error() string {
return "Unsuccessful Operation"
}