enahnce(error):将错误类型中的提示信息更改为中文。

This commit is contained in:
徐涛 2023-06-17 09:37:09 +08:00
parent e5dadf06be
commit 986562c2c2
5 changed files with 5 additions and 5 deletions

View File

@ -31,5 +31,5 @@ func NewUnauthorizedError(msg string) *UnauthorizedError {
} }
func (e UnauthorizedError) Error() string { func (e UnauthorizedError) Error() string {
return fmt.Sprintf("Unauthorized: %s", e.Message) return fmt.Sprintf("用户未获得授权: %s", e.Message)
} }

View File

@ -15,5 +15,5 @@ func NewIllegalArgumentsError(msg string, arguments ...string) IllegalArgumentsE
} }
func (e IllegalArgumentsError) Error() string { func (e IllegalArgumentsError) Error() string {
return fmt.Sprintf("Illegal Arguments, %s", e.Message) return fmt.Sprintf("使用了非法参数, %s", e.Message)
} }

View File

@ -15,5 +15,5 @@ func NewImproperOperateError(msg string, arguments ...string) ImproperOperateErr
} }
func (e ImproperOperateError) Error() string { func (e ImproperOperateError) Error() string {
return fmt.Sprintf("Improper Operate, %s", e.Message) return fmt.Sprintf("操作不恰当, %s", e.Message)
} }

View File

@ -11,7 +11,7 @@ func NewNotFoundError(msg string) *NotFoundError {
} }
func NewNotFoundErrorFromError(msg string, err error) *NotFoundError { func NewNotFoundErrorFromError(msg string, err error) *NotFoundError {
return &NotFoundError{Message: fmt.Sprintf("%s%v", msg, err)} return &NotFoundError{Message: fmt.Sprintf("所需数据未找到,%s%v", msg, err)}
} }
func (e NotFoundError) Error() string { func (e NotFoundError) Error() string {

View File

@ -7,5 +7,5 @@ func NewUnsuccessfulOperationError() *UnsuccessfulOperationError {
} }
func (UnsuccessfulOperationError) Error() string { func (UnsuccessfulOperationError) Error() string {
return "Unsuccessful Operation" return "操作不成功。"
} }