-
Notifications
You must be signed in to change notification settings - Fork 806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(retrofit): use SpinnakerServerException.getHttpMethod() instead of reflection in SpinnakerServerExceptionHandler #4675
Conversation
...in/groovy/com/netflix/spinnaker/orca/retrofit/exceptions/BaseRetrofitExceptionHandler.groovy
Show resolved
Hide resolved
65fe1a8
to
6cdc8d0
Compare
...ain/java/com/netflix/spinnaker/orca/retrofit/exceptions/SpinnakerServerExceptionHandler.java
Show resolved
Hide resolved
...java/com/netflix/spinnaker/orca/retrofit/exceptions/SpinnakerServerExceptionHandlerTest.java
Show resolved
Hide resolved
56a594a
to
5a58ab9
Compare
...java/com/netflix/spinnaker/orca/retrofit/exceptions/SpinnakerServerExceptionHandlerTest.java
Outdated
Show resolved
Hide resolved
I'm seeing a number of failures with only the commit that adds the tests, but not the code changes. Ideally there wouldn't be any failures, and the code change commit would adjust the tests so the behavior change is clear. I realize this is a lot to ask. I am quite curious what we're actually fixing in this PR though. |
Basically, the point of this PR was to avoid using reflection unless the exception was created from a During that process, I found that the exception handler's So adding retrofit2 exceptions to the parameters being passed into the tests would necessarily make them fail, which is why I originally added both the test exceptions and the code changes in the same commit. |
It would be nice to see the behavior changes in detail, but I'll get over it. Would you mind changing the PR title / commit message to be |
fc7ca50
to
2253f09
Compare
…andler to default to using SpinnakerServerException.getHttpMethod() since findHttpMethodAnnotation returns null for retrofit2 exceptions
2253f09
to
93c61e4
Compare
BaseRetrofitExceptionHandler
's retry behavior uses a method calledfindHttpMethodAnnotation
to retrieve an exception's HTTP method. For retrofit2 exceptions, this method no longer works due to things being annotated differently in retrofit2. However, Spinnaker*Exceptions can usegetHttpMethod()
to retrieve this value, so this PR updates the exception handler to default to using the getter and only usefindHttpMethodAnnotation
if the getter returns null.