Skip to content

Commit

Permalink
Feat: remove custom err
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasse committed Jun 25, 2024
1 parent 09614e1 commit fe03dfe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 6 additions & 1 deletion services/rfq/relayer/reldb/base/quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import (
"errors"
"fmt"

"github.com/ipfs/go-log"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/synapsecns/sanguine/services/rfq/relayer/reldb"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)

var logger = log.Logger("relayer-db")

// StoreQuoteRequest stores a quote request.
func (s Store) StoreQuoteRequest(ctx context.Context, request reldb.QuoteRequest) error {
rq := FromQuoteRequest(request)
Expand Down Expand Up @@ -98,7 +102,8 @@ func (s Store) UpdateQuoteRequestStatus(ctx context.Context, id [32]byte, status
prevStatus = &req.Status
}
if !isValidStateTransition(*prevStatus, status) {
return &ErrInvalidStateTransition{Msg: fmt.Sprintf("invalid state transition from %s to %s", *prevStatus, status)}
logger.Warnf("invalid state transition from %s to %s [txid=%s]", *prevStatus, status, hexutil.Encode(id[:]))
return nil
}

tx := s.DB().WithContext(ctx).Model(&RequestForQuote{}).
Expand Down
10 changes: 0 additions & 10 deletions services/rfq/relayer/reldb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,6 @@ var (
ErrNoRebalanceForID = errors.New("no rebalance found for id")
)

// ErrInvalidStateTransition is the error for an invalid state transition.
type ErrInvalidStateTransition struct {
Msg string
}

// Implement the Error method for the custom error type
func (e *ErrInvalidStateTransition) Error() string {
return e.Msg
}

// QuoteRequest is the quote request object.
type QuoteRequest struct {
BlockNumber uint64
Expand Down

0 comments on commit fe03dfe

Please sign in to comment.