Mercurial > gemma
changeset 4719:07e8436ef4de
Improve error messages for name conflicts with sections and stretches
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 17 Oct 2019 13:15:43 +0200 |
parents | 92640ae5be07 |
children | b3b33e94cee8 |
files | pkg/pgxutils/errors.go |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/pgxutils/errors.go Thu Oct 17 13:08:49 2019 +0200 +++ b/pkg/pgxutils/errors.go Thu Oct 17 13:15:43 2019 +0200 @@ -104,6 +104,26 @@ return } } + case "users": + switch err.TableName { + case "stretches": + switch err.ConstraintName { + case "stretches_name_staging_done_key": + m = "A stretch with that name already exists" + c = http.StatusConflict + return + } + } + case "waterway": + switch err.TableName { + case "sections": + switch err.ConstraintName { + case "sections_name_staging_done_key": + m = "A section with that name already exists" + c = http.StatusConflict + return + } + } } case checkViolation: switch err.SchemaName {