Skip to content

Commit aee5218

Browse files
authored
feat: expose MissingFundsErr (#107)
1 parent 9caec53 commit aee5218

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

internal/interpreter/interpreter_error.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ func (e MissingFundsErr) Error() string {
2727
return fmt.Sprintf("Not enough funds. Needed [%s %s] (only [%s %s] available)", e.Asset, e.Needed.String(), e.Asset, e.Available.String())
2828
}
2929

30+
func (e MissingFundsErr) Is(target error) bool {
31+
_, ok := target.(MissingFundsErr)
32+
return ok
33+
}
34+
3035
type InvalidMonetaryLiteral struct {
3136
parser.Range
3237
Source string

numscript.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ type (
7272
Value = interpreter.Value
7373

7474
InterpreterError = interpreter.InterpreterError
75+
MissingFundsErr = interpreter.MissingFundsErr
7576
)
7677

7778
func (p ParseResult) Run(ctx context.Context, vars VariablesMap, store Store) (ExecutionResult, InterpreterError) {

0 commit comments

Comments
 (0)