Skip to content
Snippets Groups Projects
Commit 9cd3b389 authored by Alexis Poyen's avatar Alexis Poyen
Browse files

Fix: send correct error number

parent b57ba4f6
Branches
No related tags found
No related merge requests found
......@@ -119,12 +119,12 @@ func (d *DataHandler) postBankerAdmin(w http.ResponseWriter, r *http.Request, id
// check userID is not already present in DB
var client UserClient
if err := d.db.Where(reqUserID, o.UserID).First(&client).Error; err == nil {
http.Error(w, "UserID is already bind to a Client", http.StatusNotFound)
http.Error(w, "UserID is already bind to a Client", http.StatusInternalServerError)
return
}
var banker UserBanker
if err := d.db.Where(reqUserID, o.UserID).First(&banker).Error; err == nil {
http.Error(w, "UserID is already bind to a Banker", http.StatusNotFound)
http.Error(w, "UserID is already bind to a Banker", http.StatusInternalServerError)
return
}
d.db.Create(&o)
......
......@@ -139,12 +139,12 @@ func (d *DataHandler) postClientAdmin(w http.ResponseWriter, r *http.Request, id
// check userID is not already present in DB
var client UserClient
if err := d.db.Where(reqUserID, o.UserID).First(&client).Error; err == nil {
http.Error(w, "UserID is already bind to a Client", http.StatusNotFound)
http.Error(w, "UserID is already bind to a Client", http.StatusInternalServerError)
return
}
var banker UserBanker
if err := d.db.Where(reqUserID, o.UserID).First(&banker).Error; err == nil {
http.Error(w, "UserID is already bind to a Banker", http.StatusNotFound)
http.Error(w, "UserID is already bind to a Banker", http.StatusInternalServerError)
return
}
d.db.Create(&o)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment