mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-30 21:29:44 -06:00
fix: return 404 from a few populators (#2031)
This commit is contained in:
@@ -120,6 +120,10 @@ func (p *Populator) traverseNode(c echo.Context, node *resource) error {
|
||||
err := p.callGetter(node, node.ParentID, node.ResourceID)
|
||||
|
||||
if err != nil {
|
||||
if httpErr, ok := err.(*echo.HTTPError); ok {
|
||||
return httpErr
|
||||
}
|
||||
|
||||
return fmt.Errorf("could not populate resource %s: %w", node.ResourceKey, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ func (t *APIServer) registerSpec(g *echo.Group, spec *openapi3.T) (*populator.Po
|
||||
}
|
||||
|
||||
if scheduled == nil {
|
||||
return nil, "", fmt.Errorf("scheduled workflow run not found")
|
||||
return nil, "", echo.NewHTTPError(http.StatusNotFound, "scheduled workflow run not found")
|
||||
}
|
||||
|
||||
return scheduled, sqlchelpers.UUIDToStr(scheduled.TenantId), nil
|
||||
@@ -315,7 +315,7 @@ func (t *APIServer) registerSpec(g *echo.Group, spec *openapi3.T) (*populator.Po
|
||||
}
|
||||
|
||||
if scheduled == nil {
|
||||
return nil, "", fmt.Errorf("cron workflow not found")
|
||||
return nil, "", echo.NewHTTPError(http.StatusNotFound, "cron workflow not found")
|
||||
}
|
||||
|
||||
return scheduled, sqlchelpers.UUIDToStr(scheduled.TenantId), nil
|
||||
@@ -381,7 +381,7 @@ func (t *APIServer) registerSpec(g *echo.Group, spec *openapi3.T) (*populator.Po
|
||||
}
|
||||
|
||||
if task == nil {
|
||||
return nil, "", fmt.Errorf("task not found")
|
||||
return nil, "", echo.NewHTTPError(http.StatusNotFound, "task not found")
|
||||
}
|
||||
|
||||
return task, sqlchelpers.UUIDToStr(task.TenantID), nil
|
||||
|
||||
Reference in New Issue
Block a user