-
Notifications
You must be signed in to change notification settings - Fork 230
/
errors.go
96 lines (77 loc) · 2.27 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package resourcepaths
import (
"encr.dev/pkg/errors"
)
var (
errRange = errors.Range(
"paths",
"Paths must be not be empty and always start with a '/'. You cannot define paths that conflict "+
"with each other, including static and parameterized paths. For example `/blog/:id` would conflict with `/:username`.\n\n"+
"For more information about configuring Paths, see https://encore.dev/docs/primitives/services-and-apis#rest-apis",
errors.WithRangeSize(20),
)
errEmptyPath = errRange.New(
"Invalid Path",
"Paths must not be empty.",
)
errInvalidPathPrefix = errRange.New(
"Invalid Path",
"Paths cannot start with a '/'.",
)
errInvalidPathMissingPrefix = errRange.New(
"Invalid Path",
"Paths must always start with a '/'.",
)
errInvalidPathURI = errRange.New(
"Invalid Path",
"Paths must be valid URIs. There was an error parsing the path.",
)
errPathContainedQuery = errRange.New(
"Invalid Path",
"Paths must not contain the '?' character.",
)
errEmptySegment = errRange.New(
"Invalid Path",
"Paths cannot contain an empty segment, i.e. a double slash ('//').",
)
errTrailingSlash = errRange.New(
"Invalid Path",
"Paths cannot end with a trailing slash ('/').",
)
errParameterMissingName = errRange.New(
"Invalid Path",
"Path parameters must have a name. For example, `/:id` is valid, but `/:` is not.",
)
errInvalidParamIdentifier = errRange.New(
"Invalid Path",
"Path parameters must be valid Go identifiers.",
)
errWildcardNotLastSegment = errRange.New(
"Invalid Path",
"Path wildcards must be the last segment in the path.",
)
errFallbackNotLastSegment = errRange.New(
"Invalid Path",
"Path fallbacks must be the last segment in the path.",
)
errDuplicatePath = errRange.New(
"Path Conflict",
"Duplicate Paths found.",
)
errConflictingParameterizedPath = errRange.Newf(
"Path Conflict",
"The parameter `:%s` conflicts with the path `%s`.",
)
errConflictingWildcardPath = errRange.Newf(
"Path Conflict",
"The wildcard `*%s` conflicts with the path `%s`.",
)
errConflictingLiteralPath = errRange.Newf(
"Path Conflict",
"The path segment `%s` conflicts with the path `%s`.",
)
errConflictingFallbackPath = errRange.Newf(
"Path Conflict",
"The fallback `!%s` conflicts with the path `%s`.",
)
)