diff --git a/core/item.go b/core/item.go index 886a7f9..cf121e0 100644 --- a/core/item.go +++ b/core/item.go @@ -47,6 +47,6 @@ func FormatAs(format string) (func(item Item) string, error) { case "short": return FormatAsShort, nil default: - return nil, fmt.Errorf("error: invalid format %s", format) + return nil, fmt.Errorf("invalid format '%s'", format) } } diff --git a/core/migrations.go b/core/migrations.go index 5008a03..02f01c0 100644 --- a/core/migrations.go +++ b/core/migrations.go @@ -26,7 +26,10 @@ func InitDatabase(db *DB) error { var exists bool for rows.Next() { - rows.Scan(&exists) + err = rows.Scan(&exists) + if err != nil { + return err + } } if exists { @@ -55,7 +58,10 @@ func GetPendingMigrations(db *DB) (map[string]bool, error) { } for rows.Next() { var name string - rows.Scan(&name) + err = rows.Scan(&name) + if err != nil { + return nil, err + } complete[name] = true } diff --git a/core/source.go b/core/source.go index 7fe827d..d4add29 100644 --- a/core/source.go +++ b/core/source.go @@ -100,7 +100,10 @@ func GetAllActiveItems(db *DB) ([]Item, error) { var items []Item for rows.Next() { var item Item - rows.Scan(&item.Source, &item.Id, &item.Created, &item.Active, &item.Title, &item.Author, &item.Body, &item.Link, &item.Time) + err = rows.Scan(&item.Source, &item.Id, &item.Created, &item.Active, &item.Title, &item.Author, &item.Body, &item.Link, &item.Time) + if err != nil { + return nil, err + } items = append(items, item) } return items, nil @@ -121,7 +124,10 @@ func GetActiveItemsForSource(db *DB, source string) ([]Item, error) { var items []Item for rows.Next() { var item Item - rows.Scan(&item.Source, &item.Id, &item.Created, &item.Active, &item.Title, &item.Author, &item.Body, &item.Link, &item.Time) + err = rows.Scan(&item.Source, &item.Id, &item.Created, &item.Active, &item.Title, &item.Author, &item.Body, &item.Link, &item.Time) + if err != nil { + return nil, err + } items = append(items, item) } return items, nil