Skip to content

Commit

Permalink
fixed raw sql error, not 404s (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigh-latte authored Sep 30, 2021
1 parent 7fe0979 commit cb5b841
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions data/sqlite/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,15 @@ func (s *sqliteStore) TransactionUpdateState(ctx context.Context, args payd.Tran
"failed to commit transaction when updating transactionId '%s' state to '%s'", args.TxID, req.State)
}

// Tx returns a tx from the internal store.
func (s *sqliteStore) Tx(ctx context.Context, txID string) (*bt.Tx, error) {
var txhex struct {
TxHex string `db:"tx_hex"`
}
if err := s.db.GetContext(ctx, &txhex, sqlTransactionGet, txID); err != nil {
if errors.Is(err, sql.ErrNoRows) {
return nil, lathos.NewErrNotFound("T001", fmt.Sprintf("tx '%s' not in store", txID))
}
return nil, errors.Wrapf(err, "failed to retrieve transaction for id %s", txID)
}

Expand Down

0 comments on commit cb5b841

Please sign in to comment.