Mercurial > gemma
changeset 4181:bd97dc2dceea
Add readable error message for SR import
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 05 Aug 2019 18:32:54 +0200 |
parents | 91cb4a7b1b13 |
children | 49012340336c |
files | pkg/pgxutils/errors.go |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/pgxutils/errors.go Mon Aug 05 18:21:19 2019 +0200 +++ b/pkg/pgxutils/errors.go Mon Aug 05 18:32:54 2019 +0200 @@ -25,6 +25,7 @@ notNullViolation = "23502" foreignKeyViolation = "23503" uniqueViolation = "23505" + checkViolation = "23514" violatesRowLevelSecurity = "42501" noDataFound = "P0002" ) @@ -102,6 +103,19 @@ } } } + case checkViolation: + switch err.SchemaName { + case "waterway": + switch err.TableName { + case "sounding_results": + switch err.ConstraintName { + case "b_sounding_results_in_bn_area": + m = "Dataset does not intersect with given bottleneck" + c = http.StatusConflict + return + } + } + } case noDataFound: // Most recent line from stacktrace contains name of failed function recent := strings.SplitN(err.Where, "\n", 1)[0]