aboutsummaryrefslogtreecommitdiff
path: root/pkg/field/error.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-09-14 17:56:04 +0200
committerJulien Dessaux2021-09-14 17:56:04 +0200
commit4bacbc23754a63109a2cbe68d272376a3f6847f5 (patch)
tree101e32c601ca9aabb68cf666299d761d468667a2 /pkg/field/error.go
parentInitial import (diff)
downloadgofunge98-4bacbc23754a63109a2cbe68d272376a3f6847f5.tar.gz
gofunge98-4bacbc23754a63109a2cbe68d272376a3f6847f5.tar.bz2
gofunge98-4bacbc23754a63109a2cbe68d272376a3f6847f5.zip
Began implementing the befunge field data structure
Diffstat (limited to 'pkg/field/error.go')
-rw-r--r--pkg/field/error.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/pkg/field/error.go b/pkg/field/error.go
new file mode 100644
index 0000000..82f2fec
--- /dev/null
+++ b/pkg/field/error.go
@@ -0,0 +1,34 @@
+package field
+
+import "fmt"
+
+// Read error
+type ReadError struct {
+ err error
+}
+
+func (e ReadError) Error() string {
+ return fmt.Sprintf("Failed to decode file")
+}
+func (e ReadError) Unwrap() error { return e.err }
+
+func newReadError(err error) error {
+ return &ReadError{
+ err: err,
+ }
+}
+
+// Funge decoding error
+type DecodeError struct {
+ msg string
+}
+
+func (e DecodeError) Error() string {
+ return fmt.Sprintf("Failed to decode file with message : %s", e.msg)
+}
+
+func newDecodeError(msg string) error {
+ return &DecodeError{
+ msg: msg,
+ }
+}