Skip to content

Commit

Permalink
fix(graph): return proper error on complex builds (#1009)
Browse files Browse the repository at this point in the history
do it in the other spot too
  • Loading branch information
wass3r committed Nov 24, 2023
1 parent 17be4c4 commit 3d67002
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions api/build/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,10 @@ func GetBuildGraph(c *gin.Context) {
// but it will save on processing a massive build that should not be rendered
complexity := len(steps) + len(p.Stages) + len(services)
if complexity > GraphComplexityLimit {
c.JSON(http.StatusInternalServerError, "build is too complex, too many resources")
retErr := fmt.Errorf("build is too complex, too many resources")

util.HandleError(c, http.StatusInternalServerError, retErr)

return
}

Expand Down Expand Up @@ -584,7 +587,10 @@ func GetBuildGraph(c *gin.Context) {

// validate the generated graph's complexity is beneath the limit
if len(nodes)+len(edges) > GraphComplexityLimit {
c.JSON(http.StatusInternalServerError, "graph is too complex, too many nodes and edges")
retErr := fmt.Errorf("build is too complex, too many resources")

util.HandleError(c, http.StatusInternalServerError, retErr)

return
}

Expand Down

0 comments on commit 3d67002

Please sign in to comment.