style: 错误信息英文返回-lib包

This commit is contained in:
TsMask
2023-11-08 15:00:54 +08:00
parent 81138b8c22
commit c53cd9ce16
6 changed files with 48 additions and 51 deletions

View File

@@ -3,7 +3,7 @@ package session
import (
"crypto/rand"
"encoding/base64"
"errors"
"fmt"
"io"
"net/http"
"strconv"
@@ -89,7 +89,7 @@ func (smgr *SessManager) SetSessionValue(token string, key interface{}, value in
session.values[key] = value
return nil
}
return errors.New("invalid session ID")
return fmt.Errorf("invalid session ID")
}
// GetSessionValue get value fo session
@@ -101,7 +101,7 @@ func (smgr *SessManager) GetSessionValue(token string, key interface{}) (interfa
return val, nil
}
}
return nil, errors.New("invalid session ID")
return nil, fmt.Errorf("invalid session ID")
}
func (smgr *SessManager) GetTokenFromHttpRequest(r *http.Request) string {
@@ -111,7 +111,6 @@ func (smgr *SessManager) GetTokenFromHttpRequest(r *http.Request) string {
return v[0]
}
}
return ""
}