Skip to content

Commit 1bdd2cb

Browse files
committed
Add support for TargetNotFound error
1 parent 52d98ff commit 1bdd2cb

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pkg/platform/api/buildplanner/model/buildplan.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ const (
9696
RevertConflictErrorType = "RevertConflict"
9797
CommitNotInTargetHistoryErrorType = "CommitNotInTargetHistory"
9898
ComitHasNoParentErrorType = "CommitHasNoParent"
99+
TargetNotFoundErrorType = "TargetNotFound"
99100
)
100101

101102
func IsStateToolArtifact(mimeType string) bool {
@@ -416,6 +417,12 @@ func processPlanningError(message string, subErrors []*BuildExprLocation) error
416417
}
417418

418419
for _, se := range subErrors {
420+
if se.Type == TargetNotFoundErrorType {
421+
return &BuildPlannerError{
422+
Err: locale.NewInputError("err_buildplanner_target_not_found", "{{.V0}}", se.Message),
423+
}
424+
}
425+
419426
if se.Type != RemediableSolveErrorType && se.Type != GenericSolveErrorType {
420427
continue
421428
}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mutation ($organization: String!, $project: String!, $commitId: String!, $target
2929
subErrors {
3030
__typename
3131
... on GenericSolveError {
32-
path
32+
buildExprPath
3333
message
3434
isTransient
3535
validationErrors {
@@ -38,7 +38,7 @@ mutation ($organization: String!, $project: String!, $commitId: String!, $target
3838
}
3939
}
4040
... on RemediableSolveError {
41-
path
41+
buildExprPath
4242
message
4343
isTransient
4444
errorType
@@ -52,6 +52,11 @@ mutation ($organization: String!, $project: String!, $commitId: String!, $target
5252
parameters
5353
}
5454
}
55+
... on TargetNotFound {
56+
message
57+
requestedTarget
58+
possibleTargets
59+
}
5560
}
5661
}
5762
... on NotFound {

0 commit comments

Comments
 (0)