From c365d52a808c5ea7d6bd19b4c19f85eaafe4537c Mon Sep 17 00:00:00 2001 From: Pavlos Daoglou Date: Wed, 23 Nov 2016 15:38:44 +0200 Subject: [PATCH] [6486] Fix status code when adding an existing user to org (#6678) --- pkg/api/org_users.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/api/org_users.go b/pkg/api/org_users.go index 03570619e6b..02c376eed30 100644 --- a/pkg/api/org_users.go +++ b/pkg/api/org_users.go @@ -38,6 +38,9 @@ func addOrgUserHelper(cmd m.AddOrgUserCommand) Response { cmd.UserId = userToAdd.Id if err := bus.Dispatch(&cmd); err != nil { + if err == m.ErrOrgUserAlreadyAdded { + return ApiError(409, "User is already member of this organization", nil) + } return ApiError(500, "Could not add user to organization", err) }