Skip to content

fix(generic): return error from ControllerFactory instead of calling utilruntime.Must - #752

Open
AruneshDwivedi wants to merge 1 commit into
rancher:mainfrom
AruneshDwivedi:main
Open

AruneshDwivedi wants to merge 1 commit into
rancher:mainfrom
AruneshDwivedi:main

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

Replace utilruntime.Must call with proper error handling. utilruntime.Must panics on error, making recovery impossible. Return the error from ControllerFactory so callers can handle failures gracefully.

[BUGFIX] generic: return error from ControllerFactory instead of calling utilruntime.Must

@AruneshDwivedi
AruneshDwivedi requested a review from a team as a code owner September 19, 2026 06:24

@brandond brandond left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. use of Must indicates an execution path where failure is unexpected and cannot be handled normally
  2. the requested change STILL doesn't return the error, it just uses logrus to print the error with some context - but logrus.Fatalf still causes the process to exit.
  3. the panic from Must can at least be caught via recover, unlike the os.Exit that logrus executes on Fatal

in short, the pr doesn't seem to do what you say it does, and seems like it might actually make things worse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants