Skip to content

Commit 2134b63

Browse files
committed
better error message for budget stats saving
1 parent 168d740 commit 2134b63

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/BotPlutusInterface/Contract.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,15 @@ writeBalancedTx contractEnv (Right tx) = do
301301

302302
collectBudgetStats txId pabConf = do
303303
let path = Text.unpack (Files.txFilePath pabConf "signed" (Tx.txId tx))
304-
b <- firstEitherT (Text.pack . show) $ newEitherT $ estimateBudget @w (Signed path)
305-
void $ newEitherT (Right <$> saveBudget @w txId b)
304+
txBudget <-
305+
firstEitherT toBudgetSaveError $
306+
newEitherT $ estimateBudget @w (Signed path)
307+
void $ newEitherT (Right <$> saveBudget @w txId txBudget)
308+
309+
toBudgetSaveError =
310+
Text.pack
311+
. ("Failed to save Tx budgets statistics: " ++)
312+
. show
306313

307314
pkhToText :: Ledger.PubKey -> Text
308315
pkhToText = encodeByteString . fromBuiltin . Ledger.getPubKeyHash . Ledger.pubKeyHash

0 commit comments

Comments
 (0)