Mercurial > gemma
comparison pkg/controllers/report.go @ 5595:bbc257dd9abf
Mixed bad error handling found by staticcheck.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 05 Aug 2022 12:22:06 +0200 |
parents | 5f47eeea988d |
children | 847de131893a |
comparison
equal
deleted
inserted
replaced
5594:2b6c235e33b0 | 5595:bbc257dd9abf |
---|---|
157 | 157 |
158 ctx := req.Context() | 158 ctx := req.Context() |
159 conn := middleware.GetDBConn(req) | 159 conn := middleware.GetDBConn(req) |
160 | 160 |
161 tx, err := conn.BeginTx(ctx, &sql.TxOptions{ReadOnly: true}) | 161 tx, err := conn.BeginTx(ctx, &sql.TxOptions{ReadOnly: true}) |
162 if err != nil { | |
163 http.Error(rw, "Error: "+err.Error(), http.StatusInternalServerError) | |
164 log.Errorf("%v\n", err) | |
165 return | |
166 } | |
162 defer tx.Rollback() | 167 defer tx.Rollback() |
163 | 168 |
164 if err := action.Execute(ctx, tx, template); err != nil { | 169 if err := action.Execute(ctx, tx, template); err != nil { |
165 log.Errorf("%v\n", err) | 170 log.Errorf("%v\n", err) |
166 http.Error(rw, "Error: "+err.Error(), http.StatusInternalServerError) | 171 http.Error(rw, "Error: "+err.Error(), http.StatusInternalServerError) |