Skip to content

Commit 7bc14c0

Browse files
authored
Merge pull request #3599 from ActiveState/DX-3127
Reorganize BuildPlanner Error Handling
2 parents fac37eb + b3a22a5 commit 7bc14c0

17 files changed

Lines changed: 160 additions & 349 deletions

pkg/platform/api/buildplanner/request/buildexpression.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ query ($commitID: ID!) {
1919
atTime
2020
expr
2121
}
22-
... on Error{
23-
__typename
24-
message
25-
}
26-
... on NotFound {
22+
... on Error {
2723
__typename
2824
message
2925
}

pkg/platform/api/buildplanner/request/commit.go

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,22 @@ query ($commitID: String!, $organization: String!, $project: String!, $target: S
147147
name
148148
namespace
149149
version_requirements: versionRequirements {
150-
comparator
150+
comparator
151151
version
152152
}
153153
}
154154
resolvedSource
155155
}
156156
}
157157
... on Error {
158+
__typename
158159
message
159160
}
160-
... on PlanningError {
161-
message
161+
... on ErrorWithSubErrors {
162+
__typename
162163
subErrors {
163164
__typename
164165
... on GenericSolveError {
165-
path
166166
message
167167
isTransient
168168
validationErrors {
@@ -171,37 +171,20 @@ query ($commitID: String!, $organization: String!, $project: String!, $target: S
171171
}
172172
}
173173
... on RemediableSolveError {
174-
path
175174
message
176175
isTransient
177176
errorType
178177
validationErrors {
179178
error
180179
jsonPath
181180
}
182-
suggestedRemediations {
183-
remediationType
184-
command
185-
parameters
186-
}
187-
}
188-
... on TargetNotFound {
189-
message
190-
requestedTarget
191-
possibleTargets
192181
}
193182
}
194183
}
195184
}
196185
}
197186
... on Error {
198-
message
199-
}
200-
... on NotFound {
201187
__typename
202-
type
203-
resource
204-
mayNeedAuthentication
205188
message
206189
}
207190
}
@@ -210,13 +193,6 @@ query ($commitID: String!, $organization: String!, $project: String!, $target: S
210193
__typename
211194
message
212195
}
213-
... on NotFound {
214-
__typename
215-
type
216-
resource
217-
mayNeedAuthentication
218-
message
219-
}
220196
}
221197
}
222198
`

pkg/platform/api/buildplanner/request/createproject.go

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,46 @@ type createProject struct {
1818
func (c *createProject) Query() string {
1919
return `
2020
mutation ($organization: String!, $project: String!, $private: Boolean!, $expr: BuildExpr!, $description: String!) {
21-
createProject(input:{organization:$organization, project:$project, private:$private, expr:$expr, description:$description}) {
22-
... on ProjectCreated {
23-
__typename
24-
commit {
25-
__typename
26-
commitId
27-
}
28-
}
29-
... on AlreadyExists {
30-
__typename
31-
message
32-
}
33-
... on NotFound {
34-
__typename
35-
message
36-
}
37-
... on ParseError {
38-
__typename
39-
message
40-
path
41-
}
42-
... on ValidationError {
43-
__typename
44-
message
45-
}
46-
... on Forbidden {
47-
__typename
48-
message
49-
}
50-
}
51-
}`
21+
createProject(
22+
input: {organization: $organization, project: $project, private: $private, expr: $expr, description: $description}
23+
) {
24+
... on ProjectCreated {
25+
__typename
26+
commit {
27+
__typename
28+
commitId
29+
}
30+
}
31+
... on Error {
32+
__typename
33+
message
34+
}
35+
... on ErrorWithSubErrors {
36+
__typename
37+
subErrors {
38+
__typename
39+
... on GenericSolveError {
40+
message
41+
isTransient
42+
validationErrors {
43+
error
44+
jsonPath
45+
}
46+
}
47+
... on RemediableSolveError {
48+
message
49+
isTransient
50+
errorType
51+
validationErrors {
52+
error
53+
jsonPath
54+
}
55+
}
56+
}
57+
}
58+
}
59+
}
60+
`
5261
}
5362

5463
func (c *createProject) Vars() (map[string]interface{}, error) {

pkg/platform/api/buildplanner/request/evaluate.go

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ mutation ($organization: String!, $project: String!, $commitId: String!, $target
2323
__typename
2424
status
2525
}
26-
... on PlanningError {
26+
... on Error {
2727
__typename
2828
message
29+
}
30+
... on ErrorWithSubErrors {
31+
__typename
2932
subErrors {
3033
__typename
3134
... on GenericSolveError {
32-
buildExprPath
3335
message
3436
isTransient
3537
validationErrors {
@@ -38,35 +40,19 @@ mutation ($organization: String!, $project: String!, $commitId: String!, $target
3840
}
3941
}
4042
... on RemediableSolveError {
41-
buildExprPath
4243
message
4344
isTransient
4445
errorType
4546
validationErrors {
4647
error
4748
jsonPath
4849
}
49-
suggestedRemediations {
50-
remediationType
51-
command
52-
parameters
53-
}
54-
}
55-
... on TargetNotFound {
56-
message
57-
requestedTarget
58-
possibleTargets
5950
}
6051
}
6152
}
62-
... on NotFound {
63-
type
64-
message
65-
resource
66-
mayNeedAuthentication
67-
}
6853
}
69-
}`
54+
}
55+
`
7056
}
7157

7258
func (b *evaluate) Vars() (map[string]interface{}, error) {

pkg/platform/api/buildplanner/request/mergecommit.go

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -21,52 +21,41 @@ type mergeCommit struct {
2121
func (b *mergeCommit) Query() string {
2222
return `
2323
mutation ($organization: String!, $project: String!, $targetRef: String!, $otherRef: String!, $strategy: MergeStrategy) {
24-
mergeCommit(input:{organization:$organization, project:$project, targetVcsRef:$targetRef, otherVcsRef:$otherRef, strategy:$strategy}) {
25-
... on MergedCommit {
26-
commit {
27-
__typename
28-
commitId
29-
}
30-
}
31-
... on MergeConflict {
32-
__typename
33-
message
34-
}
35-
... on FastForwardError {
36-
__typename
37-
message
38-
}
39-
... on NoCommonBaseFound {
40-
__typename
41-
message
42-
}
43-
... on NotFound {
44-
__typename
45-
message
46-
mayNeedAuthentication
24+
mergeCommit(
25+
input: {organization: $organization, project: $project, targetVcsRef: $targetRef, otherVcsRef: $otherRef, strategy: $strategy}
26+
) {
27+
... on MergedCommit {
28+
commit {
29+
__typename
30+
commitId
31+
}
4732
}
48-
... on ParseError {
33+
... on Error {
4934
__typename
5035
message
5136
}
52-
... on ValidationError {
37+
... on ErrorWithSubErrors {
5338
__typename
54-
message
55-
}
56-
... on Forbidden {
57-
__typename
58-
message
59-
}
60-
... on HeadOnBranchMoved {
61-
__typename
62-
message
63-
commitId
64-
branchId
65-
}
66-
... on NoChangeSinceLastCommit {
67-
__typename
68-
message
69-
commitId
39+
subErrors {
40+
__typename
41+
... on GenericSolveError {
42+
message
43+
isTransient
44+
validationErrors {
45+
error
46+
jsonPath
47+
}
48+
}
49+
... on RemediableSolveError {
50+
message
51+
isTransient
52+
errorType
53+
validationErrors {
54+
error
55+
jsonPath
56+
}
57+
}
58+
}
7059
}
7160
}
7261
}

pkg/platform/api/buildplanner/request/revertcommit.go

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,45 +35,36 @@ mutation ($organization: String!, $project: String!, $commitId: String!, $target
3535
commitId
3636
}
3737
}
38-
... on RevertConflict {
38+
... on Error {
3939
__typename
4040
message
41-
commitId
42-
targetCommitId
43-
conflictPaths
4441
}
45-
... on CommitHasNoParent {
42+
... on ErrorWithSubErrors {
4643
__typename
47-
message
48-
}
49-
... on NotFound {
50-
__typename
51-
message
52-
mayNeedAuthentication
53-
}
54-
... on ParseError {
55-
__typename
56-
message
57-
path
58-
}
59-
... on ValidationError {
60-
__typename
61-
message
62-
}
63-
... on Forbidden {
64-
__typename
65-
message
66-
}
67-
... on HeadOnBranchMoved {
68-
__typename
69-
message
70-
}
71-
... on NoChangeSinceLastCommit {
72-
message
73-
commitId
44+
subErrors {
45+
__typename
46+
... on GenericSolveError {
47+
message
48+
isTransient
49+
validationErrors {
50+
error
51+
jsonPath
52+
}
53+
}
54+
... on RemediableSolveError {
55+
message
56+
isTransient
57+
errorType
58+
validationErrors {
59+
error
60+
jsonPath
61+
}
62+
}
63+
}
7464
}
7565
}
76-
}`
66+
}
67+
`
7768
}
7869

7970
func (r *revertCommit) Vars() (map[string]interface{}, error) {

0 commit comments

Comments
 (0)