forked from free-lancers/electricity_bill_calc_service
refactor(session):提取获取用户会话的功能。
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user