diff options
Diffstat (limited to 'ledger/ledgercore/error.go')
-rw-r--r-- | ledger/ledgercore/error.go | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/ledger/ledgercore/error.go b/ledger/ledgercore/error.go index 65cbcff02..68185a573 100644 --- a/ledger/ledgercore/error.go +++ b/ledger/ledgercore/error.go @@ -17,12 +17,16 @@ package ledgercore import ( + "errors" "fmt" "github.com/algorand/go-algorand/data/basics" "github.com/algorand/go-algorand/data/transactions" ) +// ErrNoSpace indicates insufficient space for transaction in block +var ErrNoSpace = errors.New("block does not have space for transaction") + // TransactionInLedgerError is returned when a transaction cannot be added because it has already been done type TransactionInLedgerError struct { Txid transactions.Txid @@ -79,10 +83,27 @@ func (err ErrNoEntry) Error() string { // LogicEvalError indicates TEAL evaluation failure type LogicEvalError struct { - Err error + Err error + Details string } // Error satisfies builtin interface `error` func (err LogicEvalError) Error() string { - return fmt.Sprintf("logic eval error: %v", err.Err) + msg := fmt.Sprintf("logic eval error: %v", err.Err) + if len(err.Details) > 0 { + msg = fmt.Sprintf("%s. Details: %s", msg, err.Details) + } + return msg +} + +// ErrNonSequentialBlockEval provides feedback when the evaluator cannot be created for +// stale/future rounds. +type ErrNonSequentialBlockEval struct { + EvaluatorRound basics.Round // EvaluatorRound is the round the evaluator was created for + LatestRound basics.Round // LatestRound is the latest round available on disk +} + +// Error satisfies builtin interface `error` +func (err ErrNonSequentialBlockEval) Error() string { + return fmt.Sprintf("block evaluation for round %d requires sequential evaluation while the latest round is %d", err.EvaluatorRound, err.LatestRound) } |