diff --git a/docs/content/doc/usage/errors.md b/docs/content/doc/usage/errors.md index cc89e1b4a..a312284f9 100644 --- a/docs/content/doc/usage/errors.md +++ b/docs/content/doc/usage/errors.md @@ -33,6 +33,7 @@ This document describes the different errors Vikunja can return. | 3004 | 403 | The user needs to have read permissions on that list to perform that action. | | 3005 | 400 | The list title cannot be empty. | | 3006 | 404 | The list share does not exist. | +| 3007 | 400 | A list with this identifier already exists. | | 4001 | 400 | The list task text cannot be empty. | | 4002 | 404 | The list task does not exist. | | 4003 | 403 | All bulk editing tasks must belong to the same list. | diff --git a/pkg/models/error.go b/pkg/models/error.go index 0acb6cbb0..9824fe2b8 100644 --- a/pkg/models/error.go +++ b/pkg/models/error.go @@ -491,7 +491,11 @@ const ErrCodeListIdentifierIsNotUnique = 3007 // HTTPError holds the http error description func (err ErrListIdentifierIsNotUnique) HTTPError() web.HTTPError { - return web.HTTPError{HTTPCode: http.StatusNotFound, Code: ErrCodeListIdentifierIsNotUnique, Message: "There already exists a list with this identifier."} + return web.HTTPError{ + HTTPCode: http.StatusBadRequest, + Code: ErrCodeListIdentifierIsNotUnique, + Message: "A list with this identifier already exists.", + } } // ================