-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
39 lines (32 loc) · 985 Bytes
/
Copy patherrors.go
File metadata and controls
39 lines (32 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package recv
import (
"fmt"
)
// returned when a converter doesn't convert input successfully
type ConversionError struct {
// The arg that the converter belongs to
Arg *CommandArg
// The input that failed to convert
Input string
// The position of the arg in the command arguments - indexed on 1
ArgPosition int
}
func (e ConversionError) Error() string {
return fmt.Sprintf("converter \"%s\" failed to convert input \"%s\"", e.Arg.Converter.Name, e.Input)
}
// returned when a required argument is missing
type MissingRequiredArgumentError struct {
Arg *CommandArg
ArgPosition int
}
func (e MissingRequiredArgumentError) Error() string {
return fmt.Sprintf("required argument \"%s\" at position %v is missing", e.Arg.Name, e.ArgPosition)
}
// returned when a command check fails
type CheckError struct {
// the check that failed
Check *CommandCheck
}
func (e CheckError) Error() string {
return fmt.Sprintf("command check \"%s\" failed", e.Check.Name)
}