summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/user/email.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/api/v1/user/email.go b/routers/api/v1/user/email.go
index bc8b2fa87b..9dd35f91b6 100644
--- a/routers/api/v1/user/email.go
+++ b/routers/api/v1/user/email.go
@@ -111,6 +111,8 @@ func DeleteEmail(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.DeleteEmailOption)
if len(form.Emails) == 0 {
ctx.Status(http.StatusNoContent)
@@ -126,6 +128,10 @@ func DeleteEmail(ctx *context.APIContext) {
}
if err := models.DeleteEmailAddresses(emails); err != nil {
+ if models.IsErrEmailAddressNotExist(err) {
+ ctx.Error(http.StatusNotFound, "DeleteEmailAddresses", err)
+ return
+ }
ctx.Error(http.StatusInternalServerError, "DeleteEmailAddresses", err)
return
}