10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 354ba4d commit ac353a2Copy full SHA for ac353a2
controllers/auth.controller.go
@@ -56,7 +56,10 @@ func (ac *AuthController) SignUpUser(ctx *gin.Context) {
56
57
result := ac.DB.Create(&newUser)
58
59
- if result.Error != nil {
+ if result.Error != nil && strings.Contains(result.Error.Error(), "duplicate key value violates unique") {
60
+ ctx.JSON(http.StatusCo 53EC nflict, gin.H{"status": "fail", "message": "User with that email already exists"})
61
+ return
62
+ } else if result.Error != nil {
63
ctx.JSON(http.StatusBadGateway, gin.H{"status": "error", "message": "Something bad happened"})
64
return
65
}
0 commit comments