Commit 9cd3b389 authored by Alexis POYEN's avatar Alexis POYEN
Browse files

Fix: send correct error number

parent b57ba4f6
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment