Wrap some errors
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing

This commit is contained in:
2022-08-21 19:56:55 +00:00
parent 4ef0b759ef
commit 2f636b5f9c
3 changed files with 12 additions and 9 deletions

View File

@ -1,6 +1,7 @@
package server
import (
"fmt"
"net/http"
"git.javil.eu/jacob1123/budgeteer/postgres"
@ -26,12 +27,12 @@ func (h *Handler) importYNAB(c echo.Context) error {
transactionsFile, err := c.FormFile("transactions")
if err != nil {
return err
return fmt.Errorf("get transactions: %w", err)
}
transactions, err := transactionsFile.Open()
if err != nil {
return err
return fmt.Errorf("open transactions: %w", err)
}
err = ynab.ImportTransactions(c.Request().Context(), transactions)
@ -41,12 +42,12 @@ func (h *Handler) importYNAB(c echo.Context) error {
assignmentsFile, err := c.FormFile("assignments")
if err != nil {
return err
return fmt.Errorf("get assignments: %w", err)
}
assignments, err := assignmentsFile.Open()
if err != nil {
return err
return fmt.Errorf("open assignments: %w", err)
}
err = ynab.ImportAssignments(c.Request().Context(), assignments)