mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-19 02:26:27 +00:00
Use eris for error management
This commit is contained in:
@ -2,7 +2,6 @@ package user
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
goerrors "errors"
|
||||
"fmt"
|
||||
|
||||
"npm/internal/database"
|
||||
@ -10,6 +9,8 @@ import (
|
||||
"npm/internal/errors"
|
||||
"npm/internal/logger"
|
||||
"npm/internal/model"
|
||||
|
||||
"github.com/rotisserie/eris"
|
||||
)
|
||||
|
||||
// GetByID finds a user by ID
|
||||
@ -33,7 +34,7 @@ func Create(user *Model) (int, error) {
|
||||
// database schema, but it's a bit more complex because of the is_deleted field.
|
||||
|
||||
if user.ID != 0 {
|
||||
return 0, goerrors.New("Cannot create user when model already has an ID")
|
||||
return 0, eris.New("Cannot create user when model already has an ID")
|
||||
}
|
||||
|
||||
// Check if an existing user with this email exists
|
||||
@ -77,7 +78,7 @@ func Create(user *Model) (int, error) {
|
||||
// Update will Update a User from this model
|
||||
func Update(user *Model) error {
|
||||
if user.ID == 0 {
|
||||
return goerrors.New("Cannot update user when model doesn't have an ID")
|
||||
return eris.New("Cannot update user when model doesn't have an ID")
|
||||
}
|
||||
|
||||
// Check that the email address isn't associated with another user
|
||||
|
Reference in New Issue
Block a user