-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
behavior of operations when an item does not exist #3126
Comments
I think all operations should return |
Current behavior: Always a 404 - edit, editStatus, accept, some other operations such as scale, and of course require ServiceOperationImpl patch/replace are different still #3121 Are you looking for all of these to consistently return null instead? |
All the operations you mention are write operations. Is the behavior the same with read operations? |
I would like to go with the option which doesn't break current behavior that much for users. If we're returning |
get returns null, require actually throws a ResourceNotFoundException (which is not a KubernetesClientException) rather than a 404.
It looks like 404 is the dominant case. Would you be good if patch/replace throw a 404 when not found?
get behavior seems appropriate and is documented that way in the javadoc. require should throw an exception - but the ResourceNotFoundException seem a little odd in that it can mask the underlying exception. It should at least chain to the KubernetesClientException or just let them be thrown - Line 211 in 6a135a7
What other read operations are there to consider? |
Not sure of what we have now, but logic says that any replace operation to a non-existent resource should throw an exception. I'm not that sure about PATCH, and since these methods are newer, having a proper alignment with client-go might be the best approach. |
From what I can see the go client will throw the 404 exception. I'll update #3123 to have more consistency across all operations. |
Related to #3121 what should the expectations for operations when the current item does not exist? Some of the logic used getManditory, which will throw a 404. Other operations (like patch and replace) will use fromServer which then performs a get that will return null. Should all operations return null or throw a 404?
cc @rohanKanojia
The text was updated successfully, but these errors were encountered: