Skip to content

Commit

Permalink
refactor: elcontracts error handling (#463)
Browse files Browse the repository at this point in the history
Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
  • Loading branch information
damiramirez and MegaRedHand authored Feb 3, 2025
1 parent 48a3026 commit 870f687
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions chainio/clients/elcontracts/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (w *ChainWriter) RegisterAsOperator(
}
receipt, err := w.txMgr.Send(ctx, tx, waitForReceipt)
if err != nil {
return nil, errors.New("failed to send tx with err: " + err.Error())
return nil, utils.WrapError("failed to send tx", err)
}
w.logger.Info("tx successfully included", "txHash", receipt.TxHash.String())

Expand Down Expand Up @@ -191,7 +191,7 @@ func (w *ChainWriter) UpdateOperatorDetails(
}
receipt, err := w.txMgr.Send(ctx, tx, waitForReceipt)
if err != nil {
return nil, errors.New("failed to send tx with err: " + err.Error())
return nil, utils.WrapError("failed to send tx", err)
}
w.logger.Info(
"successfully updated operator details",
Expand Down Expand Up @@ -226,7 +226,7 @@ func (w *ChainWriter) UpdateMetadataURI(
}
receipt, err := w.txMgr.Send(ctx, tx, waitForReceipt)
if err != nil {
return nil, errors.New("failed to send tx with err: " + err.Error())
return nil, utils.WrapError("failed to send tx", err)
}
w.logger.Info(
"successfully updated operator metadata uri",
Expand Down Expand Up @@ -268,7 +268,7 @@ func (w *ChainWriter) DepositERC20IntoStrategy(
}
_, err = w.txMgr.Send(ctx, tx, waitForReceipt)
if err != nil {
return nil, errors.New("failed to send tx with err: " + err.Error())
return nil, utils.WrapError("failed to send tx", err)
}

tx, err = w.strategyManager.DepositIntoStrategy(noSendTxOpts, strategyAddr, underlyingTokenAddr, amount)
Expand All @@ -277,7 +277,7 @@ func (w *ChainWriter) DepositERC20IntoStrategy(
}
receipt, err := w.txMgr.Send(ctx, tx, waitForReceipt)
if err != nil {
return nil, errors.New("failed to send tx with err: " + err.Error())
return nil, utils.WrapError("failed to send tx", err)
}

w.logger.Infof("deposited %s into strategy %s", amount.String(), strategyAddr)
Expand Down

0 comments on commit 870f687

Please sign in to comment.