comparison pkg/imports/st.go @ 4180:91cb4a7b1b13

Always try to translate to readable error if import failed
author Tom Gottfried <tom@intevation.de>
date Mon, 05 Aug 2019 18:21:19 +0200
parents a376351d2774
children f9bb06f2dbe3
comparison
equal deleted inserted replaced
4179:a376351d2774 4180:91cb4a7b1b13
18 "database/sql" 18 "database/sql"
19 "errors" 19 "errors"
20 "time" 20 "time"
21 21
22 "gemma.intevation.de/gemma/pkg/models" 22 "gemma.intevation.de/gemma/pkg/models"
23 "gemma.intevation.de/gemma/pkg/pgxutils"
24 ) 23 )
25 24
26 // Stretch is a Job to create a stretch in the database. 25 // Stretch is a Job to create a stretch in the database.
27 type Stretch struct { 26 type Stretch struct {
28 Name string `json:"name"` 27 Name string `json:"name"`
203 nobjnm, 202 nobjnm,
204 st.Date.Time, 203 st.Date.Time,
205 st.Source, 204 st.Source,
206 st.Tolerance, 205 st.Tolerance,
207 ).Scan(&id); err != nil { 206 ).Scan(&id); err != nil {
208 return nil, pgxutils.ReadableError{Err: err} 207 return nil, err
209 } 208 }
210 209
211 // store the associated countries. 210 // store the associated countries.
212 211
213 feedback.Info("Countries associated with stretch: %s.", st.Countries) 212 feedback.Info("Countries associated with stretch: %s.", st.Countries)