diff --git a/cmd/serverFunc.go b/cmd/serverFunc.go index e340da3..8bd96b6 100644 --- a/cmd/serverFunc.go +++ b/cmd/serverFunc.go @@ -108,6 +108,10 @@ func getUser(c *gin.Context) { user := user{} err := db.QueryRow("SELECT id_alumno,nombre,apellido1,apellido2,email FROM alumnos WHERE id_alumno = "+id).Scan(&user.Id, &user.Name, &user.Surname1, &user.Surname2, &user.Email) if err != nil { + if err == sql.ErrNoRows { + c.String(http.StatusNotFound, "User not found") + return + } e := fmt.Sprintf("SOMETHING BAD HAPPENED QUERYING THE DATABASE: %v\n", err) log.Print(e) c.String(http.StatusInternalServerError, e)