summaryrefslogtreecommitdiff
path: root/vendor/github.com/dalzilio/rudd/errors.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/dalzilio/rudd/errors.go')
-rw-r--r--vendor/github.com/dalzilio/rudd/errors.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/github.com/dalzilio/rudd/errors.go b/vendor/github.com/dalzilio/rudd/errors.go
new file mode 100644
index 0000000..7db6976
--- /dev/null
+++ b/vendor/github.com/dalzilio/rudd/errors.go
@@ -0,0 +1,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
+}