mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
Use eris for error management
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
package jwt
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"npm/internal/entity/user"
|
||||
"npm/internal/logger"
|
||||
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/rotisserie/eris"
|
||||
)
|
||||
|
||||
// UserJWTClaims is the structure of a JWT for a User
|
||||
@ -47,7 +47,7 @@ func Generate(userObj *user.Model) (GeneratedResponse, error) {
|
||||
var err error
|
||||
token.Signature, err = token.SignedString(key)
|
||||
if err != nil {
|
||||
logger.Error("JWTError", fmt.Errorf("Error signing token: %v", err))
|
||||
logger.Error("JWTError", eris.Wrapf(err, "Error signing token: %v", err))
|
||||
return response, err
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,10 @@ import (
|
||||
"crypto/rsa"
|
||||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
|
||||
"npm/internal/config"
|
||||
|
||||
"github.com/rotisserie/eris"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -21,7 +22,7 @@ func GetPrivateKey() (*rsa.PrivateKey, error) {
|
||||
var blankKey *rsa.PrivateKey
|
||||
|
||||
if config.PrivateKey == "" {
|
||||
return blankKey, errors.New("Could not get Private Key from configuration")
|
||||
return blankKey, eris.New("Could not get Private Key from configuration")
|
||||
}
|
||||
|
||||
var err error
|
||||
@ -48,7 +49,7 @@ func GetPublicKey() (*rsa.PublicKey, error) {
|
||||
var blankKey *rsa.PublicKey
|
||||
|
||||
if config.PublicKey == "" {
|
||||
return blankKey, errors.New("Could not get Public Key filename, check environment variables")
|
||||
return blankKey, eris.New("Could not get Public Key filename, check environment variables")
|
||||
}
|
||||
|
||||
var err error
|
||||
|
Reference in New Issue
Block a user