Skip to content

Commit

Permalink
extract: Don't crash when the error is not an ErrorPrimitiveReached
Browse files Browse the repository at this point in the history
When there's an invalid Kubernetes object, we can get a
`*manifest.SchemaError` here, for example. We currently panic, but
instead we should return the error so it can be displayed properly.
  • Loading branch information
iainlane committed Dec 5, 2023
1 parent 9f21bbe commit 8867d7e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/process/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ func walkObj(obj objx.Map, extracted map[string]manifest.Manifest, path trace) e
}
err := walkJSON(obj[key], extracted, path)
if err != nil {
return err.(ErrorPrimitiveReached).WithContainingObj(obj, manifestErr)
if err, ok := err.(ErrorPrimitiveReached); ok {
return err.WithContainingObj(obj, manifestErr)
}

return err
}
}

Expand Down

0 comments on commit 8867d7e

Please sign in to comment.