# HG changeset patch # User Tom Gottfried # Date 1553260808 -3600 # Node ID 5850ac0f9ab62f82b7fc048dfdede35257fa1c8b # Parent 21eb85cdfe450ac13494e4f06888674f6f83ab0e Axis import: do not fail if one item fails. diff -r 21eb85cdfe45 -r 5850ac0f9ab6 pkg/imports/wx.go --- a/pkg/imports/wx.go Fri Mar 22 13:26:24 2019 +0100 +++ b/pkg/imports/wx.go Fri Mar 22 14:20:08 2019 +0100 @@ -214,6 +214,8 @@ feedback.Info("Using EPSG: %d", epsg) + savepoint := Savepoint(ctx, tx, "feature") + for _, feature := range rfc.Features { if feature.Properties == nil || feature.Geometry.Coordinates == nil { missingProperties++ @@ -240,7 +242,7 @@ } if err := storeLinestring( ctx, - tx, + savepoint, feedback, l, epsg, @@ -259,7 +261,7 @@ for _, l := range ls { if err := storeLinestring( ctx, - tx, + savepoint, feedback, l, epsg, @@ -308,7 +310,7 @@ func storeLinestring( ctx context.Context, - tx *sql.Tx, + savepoint func(func() error) error, feedback Feedback, l lineSlice, epsg int, @@ -317,14 +319,17 @@ checkCrossingStmt, insertStmt *sql.Stmt, ) error { var id int - if err := insertStmt.QueryRowContext( - ctx, - l.asWKB(), - epsg, - props.ObjNam, - nobjnam, - ).Scan(&id); err != nil { + if err := savepoint(func() error { + err := insertStmt.QueryRowContext( + ctx, + l.asWKB(), + epsg, + props.ObjNam, + nobjnam, + ).Scan(&id) return err + }); err != nil { + feedback.Warn(handleError(err).Error()) } var crossing string