Stop errorfactory from creating errors with nil causes #451
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this PR?
Currently when the errorfactory is invoked with a
nil
error the errorfactory will produce an error that hasnil
error field. This PR will create a new underlying error when presented with anil
error.Why?
Some consumers of the error assume that the error has been populated and when they access the field it triggers a panic. In particular logging code like this in
nificluster_controller.go
fails:Some error producers need to report errors even the underlying failure doesn't produce an error itself. For example in
client.go
:Additional Context
This failure made it more difficult to diagnose some underlying connectivity and configuration issues that I encountered when I moved on from an insecure cluster to an SSL-secured one.
Checklist