changeset 4871:4d8982fa49f9

Restore naming scheme
author Tom Gottfried <tom@intevation.de>
date Tue, 14 Jan 2020 15:05:44 +0100
parents b55120fa8913
children 5c12b7cdc58c
files pkg/pgxutils/errors.go
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/pgxutils/errors.go	Thu Jan 09 17:23:54 2020 +0100
+++ b/pkg/pgxutils/errors.go	Tue Jan 14 15:05:44 2020 +0100
@@ -22,14 +22,16 @@
 )
 
 const (
-	notNullViolation         = "23502"
-	foreignKeyViolation      = "23503"
-	uniqueViolation          = "23505"
-	checkViolation           = "23514"
-	exclusionViolation       = "23P01"
-	violatesRowLevelSecurity = "42501"
-	duplicateObject          = "42710"
-	noDataFound              = "P0002"
+	// camel cased condition name = error code
+	// from appendix A of PostgreSQL documentation
+	notNullViolation      = "23502"
+	foreignKeyViolation   = "23503"
+	uniqueViolation       = "23505"
+	checkViolation        = "23514"
+	exclusionViolation    = "23P01"
+	insufficientPrivilege = "42501"
+	duplicateObject       = "42710"
+	noDataFound           = "P0002"
 )
 
 // ReadableError wraps a given error Err and
@@ -165,7 +167,7 @@
 			m = "No area around axis between given ISRS Location Codes"
 			return
 		}
-	case violatesRowLevelSecurity:
+	case insufficientPrivilege:
 		m = "Could not save: Data outside the area of responsibility."
 		return
 	}