Began implementing the befunge field data structure
This commit is contained in:
parent
79a970515f
commit
4bacbc2375
13 changed files with 325 additions and 0 deletions
34
pkg/field/error.go
Normal file
34
pkg/field/error.go
Normal file
|
@ -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,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue