changeset 3664:58508f50d192

SR import: Made error messages symmetrical to multi beam if no matching bottleneck is found for single beam imports.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 14 Jun 2019 17:56:42 +0200
parents f8e684108425
children 29ef6d41e4af
files pkg/imports/sr.go
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/sr.go	Fri Jun 14 16:21:25 2019 +0200
+++ b/pkg/imports/sr.go	Fri Jun 14 17:56:42 2019 +0200
@@ -556,7 +556,7 @@
 
 	var hull []byte
 
-	if err := tx.QueryRowContext(
+	err = tx.QueryRowContext(
 		ctx,
 		insertHullSQL,
 		m.Bottleneck,
@@ -571,7 +571,13 @@
 		&lon,
 		&dummy,
 		&hull,
-	); err != nil {
+	)
+
+	switch {
+	case err == sql.ErrNoRows:
+		return nil, fmt.Errorf(
+			"No matching bottleneck of given name or time available: %v", err)
+	case err != nil:
 		return nil, err
 	}
 
@@ -656,7 +662,7 @@
 	switch {
 	case err == sql.ErrNoRows:
 		return nil, fmt.Errorf(
-			"No bottleneck matching given name and time available")
+			"No matching bottleneck of given name or time available: %v", err)
 	case err != nil:
 		return nil, err
 	}