This commit is contained in:
parent
9b51680af5
commit
c2b8db238e
24 changed files with 624 additions and 232 deletions
14
src/errors/Common.go
Normal file
14
src/errors/Common.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
package errors
|
||||
|
||||
var (
|
||||
ExpectedFunctionDefinition = &String{"Expected function definition"}
|
||||
ExpectedPackageName = &String{"Expected package name"}
|
||||
InvalidDefinition = &String{"Invalid definition"}
|
||||
MissingBlockStart = &String{"Missing '{'"}
|
||||
MissingBlockEnd = &String{"Missing '}'"}
|
||||
MissingGroupStart = &String{"Missing '('"}
|
||||
MissingGroupEnd = &String{"Missing ')'"}
|
||||
MissingParameter = &String{"Missing parameter"}
|
||||
MissingType = &String{"Missing type"}
|
||||
NoInputFiles = &String{"No input files"}
|
||||
)
|
13
src/errors/InvalidCharacter.go
Normal file
13
src/errors/InvalidCharacter.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package errors
|
||||
|
||||
import "fmt"
|
||||
|
||||
// InvalidCharacter is created when an invalid character appears.
|
||||
type InvalidCharacter struct {
|
||||
Character string
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (err *InvalidCharacter) Error() string {
|
||||
return fmt.Sprintf("Invalid character '%s'", err.Character)
|
||||
}
|
13
src/errors/InvalidTopLevel.go
Normal file
13
src/errors/InvalidTopLevel.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package errors
|
||||
|
||||
import "fmt"
|
||||
|
||||
// InvalidTopLevel error is created when a top-level instruction is not valid.
|
||||
type InvalidTopLevel struct {
|
||||
Instruction string
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (err *InvalidTopLevel) Error() string {
|
||||
return fmt.Sprintf("Invalid top level instruction '%s'", err.Instruction)
|
||||
}
|
13
src/errors/IsNotDirectory.go
Normal file
13
src/errors/IsNotDirectory.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package errors
|
||||
|
||||
import "fmt"
|
||||
|
||||
// IsNotDirectory error is created when a path is not a directory.
|
||||
type IsNotDirectory struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (err *IsNotDirectory) Error() string {
|
||||
return fmt.Sprintf("'%s' is not a directory", err.Path)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue