This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new acc2297129 return correct error on duplicate email while updating user 
(#7394)
acc2297129 is described below

commit acc2297129488a2b2449baa68293a2353a9c45b2
Author: Kunal Kundu <[email protected]>
AuthorDate: Tue Mar 14 01:12:20 2023 +0530

    return correct error on duplicate email while updating user (#7394)
---
 traffic_ops/traffic_ops_golang/user/current.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/traffic_ops/traffic_ops_golang/user/current.go 
b/traffic_ops/traffic_ops_golang/user/current.go
index 87860fef9d..6caecb10ca 100644
--- a/traffic_ops/traffic_ops_golang/user/current.go
+++ b/traffic_ops/traffic_ops_golang/user/current.go
@@ -479,9 +479,9 @@ func ReplaceCurrent(w http.ResponseWriter, r *http.Request) 
{
        }
 
        if err = updateLegacyUser(&user, tx, changePasswd, 
changeConfirmPasswd); err != nil {
-               errCode = http.StatusInternalServerError
+               userErr, sysErr, statusCode := api.ParseDBError(err)
                sysErr = fmt.Errorf("updating legacy user: %w", err)
-               api.HandleErr(w, r, tx, errCode, nil, sysErr)
+               api.HandleErr(w, r, tx, statusCode, userErr, sysErr)
                return
        }
 
@@ -600,9 +600,9 @@ func ReplaceCurrentV4(w http.ResponseWriter, r 
*http.Request) {
        }
 
        if err := updateUser(&user, tx, changePasswd); err != nil {
-               errCode = http.StatusInternalServerError
+               userErr, sysErr, statusCode := api.ParseDBError(err)
                sysErr = fmt.Errorf("updating user: %w", err)
-               api.HandleErr(w, r, tx, errCode, nil, sysErr)
+               api.HandleErr(w, r, tx, statusCode, userErr, sysErr)
                return
        }
 

Reply via email to