comparison pkg/imports/errors.go @ 3533:8e083b271fca

Improve error messages if no matching gauge version found Avoid hitting the NOT NULL constraint of the referencing validity column in order to hit the foreign key constraint instead and emit an appropriate error message in all such cases.
author Tom Gottfried <tom@intevation.de>
date Wed, 29 May 2019 18:14:20 +0200
parents e0dabe7b2fcf
children 453f15ba8030
comparison
equal deleted inserted replaced
3530:e98ea184538e 3533:8e083b271fca
55 } 55 }
56 case foreignKeyViolation: 56 case foreignKeyViolation:
57 switch err.SchemaName { 57 switch err.SchemaName {
58 case "waterway": 58 case "waterway":
59 switch err.TableName { 59 switch err.TableName {
60 case "gauge_measurements": 60 case "gauge_measurements", "gauge_predictions", "bottlenecks":
61 switch err.ConstraintName { 61 switch err.ConstraintName {
62 case "gauge_key": 62 case "gauge_key":
63 return "Referenced gauge is not in database" 63 return "Referenced gauge with matching temporal validity not available"
64 } 64 }
65 } 65 }
66 } 66 }
67 case noDataFound: 67 case noDataFound:
68 // Most recent line from stacktrace contains name of failed function 68 // Most recent line from stacktrace contains name of failed function