refactor(session):提取获取用户会话的功能。

This commit is contained in:
徐涛
2022-08-16 06:08:04 +08:00
parent c7b87992dd
commit edabcea58d
3 changed files with 40 additions and 16 deletions

View File

@@ -19,3 +19,17 @@ func NewAuthenticationError(code int16, msg string) *AuthenticationError {
func (e AuthenticationError) Error() string {
return fmt.Sprintf("[%d]%s", e.Code, e.Message)
}
type UnauthorizedError struct {
Message string
}
func NewUnauthorizedError(msg string) *UnauthorizedError {
return &UnauthorizedError{
Message: msg,
}
}
func (e UnauthorizedError) Error() string {
return fmt.Sprintf("Unauthorized: %s", e.Message)
}