-
Notifications
You must be signed in to change notification settings - Fork 320
/
errors.go
69 lines (55 loc) · 1.76 KB
/
errors.go
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package directive
import (
"encr.dev/pkg/errors"
)
var (
errRange = errors.Range(
"directive",
"",
errors.WithRangeSize(20),
)
errMultipleDirectives = errRange.New(
"Multiple Directives",
"Multiple directives are not allowed on the same declaration.",
)
errMissingDirectiveName = errRange.New(
"Invalid Encore Directive",
"Directives must have a name. For example, `//encore:api` is valid, but `//encore:` is not.",
)
errDuplicateTag = errRange.Newf(
"Duplicate Tag",
"The tag %q is already defined on this declaration. Tags must be unique per directive.",
)
errInvalidTag = errRange.Newf(
"Invalid Tag",
"Invalid tag %q. Tags must start with a letter and contain only letters, numbers, hyphens and underscores.",
)
errFieldHasNoValue = errRange.New(
"Invalid Directive Field",
"Directive fields must have a value. For example, `//encore:api foo=bar` is valid, but `//encore:api foo=` is not.",
)
errInvalidFieldName = errRange.Newf(
"Invalid Directive Field",
"Invalid field name %q. Field names must start only contain letters.",
)
errDuplicateField = errRange.Newf(
"Duplicate Directive Field",
"The field %q is already defined on this directive. Fields must be unique per directive.",
)
errUnknownField = errRange.Newf(
"Invalid Directive Field",
"Unknown field %q. Fields must be one of %s.",
)
errInvalidOptionName = errRange.Newf(
"Invalid Directive Option",
"Invalid option name %q. Options must start only contain letters.",
)
errDuplicateOption = errRange.Newf(
"Duplicate Directive Option",
"The option %q is already defined on this directive. Options must be unique per directive.",
)
errUnknownOption = errRange.Newf(
"Invalid Directive Option",
"Unknown option %q. Options must be one of %s.",
)
)