mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-05 01:59:44 +01:00
Return 409 instead of 500 for duplicate project member (#14727)
Fixes #14621 Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
parent
5b526b8dc7
commit
c946457eef
@ -68,10 +68,10 @@ type UserGroup struct {
|
||||
}
|
||||
|
||||
// ErrDuplicateProjectMember ...
|
||||
var ErrDuplicateProjectMember = errors.New("The project member specified already exist")
|
||||
var ErrDuplicateProjectMember = errors.ConflictError(nil).WithMessage("The project member specified already exist")
|
||||
|
||||
// ErrInvalidRole ...
|
||||
var ErrInvalidRole = errors.New("Failed to update project member, role is not in 1,2,3")
|
||||
var ErrInvalidRole = errors.BadRequestError(nil).WithMessage("Failed to update project member, role is not in 1,2,3")
|
||||
|
||||
type controller struct {
|
||||
userManager user.Manager
|
||||
|
@ -56,7 +56,7 @@ func New() DAO {
|
||||
}
|
||||
|
||||
// ErrGroupNameDup ...
|
||||
var ErrGroupNameDup = errors.New("duplicated user group name")
|
||||
var ErrGroupNameDup = errors.ConflictError(nil).WithMessage("duplicated user group name")
|
||||
|
||||
// Add - Add User Group
|
||||
func (d *dao) Add(ctx context.Context, userGroup model.UserGroup) (int, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user