2018-11-08 12:41:07 +00:00
|
|
|
package instruction
|
|
|
|
|
|
|
|
import (
|
2018-11-14 21:10:31 +00:00
|
|
|
"fmt"
|
2018-11-08 12:41:07 +00:00
|
|
|
)
|
|
|
|
|
2018-11-12 23:41:42 +00:00
|
|
|
// ErrInvalidAlias is raised when encountering an invalid token in an alias name
|
2018-11-14 21:10:31 +00:00
|
|
|
var ErrInvalidAlias = fmt.Errorf("invalid alias name (contains '/')")
|
2018-11-12 23:41:42 +00:00
|
|
|
|
2018-11-11 18:01:00 +00:00
|
|
|
// ErrInvalidSyntax is raised when encountering an invalid token
|
2018-11-14 21:10:31 +00:00
|
|
|
var ErrInvalidSyntax = fmt.Errorf("invalid instruction format")
|
2018-11-11 18:01:00 +00:00
|
|
|
|
|
|
|
// ErrUnknownInstruction is raised when encountering an unknown instruction
|
|
|
|
// it can mean that you're not using the right version or that you've misspelled it
|
2018-11-14 21:10:31 +00:00
|
|
|
var ErrUnknownInstruction = fmt.Errorf("unknown instruction")
|
|
|
|
|
2018-11-16 05:57:57 +00:00
|
|
|
// FileError is used for file-specific errors
|
2018-11-14 21:10:31 +00:00
|
|
|
type FileError struct {
|
|
|
|
Reason string
|
|
|
|
File string
|
|
|
|
Err error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ce FileError) Error() string {
|
|
|
|
if ce.Err == nil {
|
|
|
|
return fmt.Sprintf("%s '%s'", ce.Reason, ce.File)
|
|
|
|
}
|
|
|
|
return fmt.Sprintf("%s '%s' | %s", ce.Reason, ce.File, ce.Err)
|
|
|
|
}
|