summaryrefslogtreecommitdiff
path: root/vendor/github.com/dalzilio/rudd/errors.go
blob: 7db6976aba12433a113b9e6dcd3a5db9f4cb8b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2021 Silvano DAL ZILIO
//
// MIT License

package rudd

import (
	"fmt"
	"log"
)

// Error returns the error status of the BDD.
func (b *BDD) Error() string {
	if b.error == nil {
		return ""
	}
	return b.error.Error()
}

// Errored returns true if there was an error during a computation.
func (b *BDD) Errored() bool {
	return b.error != nil
}

func (b *BDD) seterror(format string, a ...interface{}) Node {
	if b.error != nil {
		format = format + "; " + b.Error()
		b.error = fmt.Errorf(format, a...)
		return nil
	}
	b.error = fmt.Errorf(format, a...)
	if _DEBUG {
		log.Println(b.error)
	}
	return nil
}