Allow classes without the proper interface to still work on JDK < 16#19
Allow classes without the proper interface to still work on JDK < 16#19mcnoreau12 merged 2 commits intomaincoveooss/feign-error-decoder:mainfrom feature/retro-compatibilitycoveooss/feign-error-decoder:feature/retro-compatibilityCopy head branch name to clipboard
Conversation
| @@ -0,0 +1,30 @@ | ||
| package com.coveo.feign; | ||
|
|
||
| public abstract class BaseServiceException extends Exception { |
There was a problem hiding this comment.
why did you add this exception type ? It would have worked with current ServiceException no ? just curious
There was a problem hiding this comment.
I needed this exception to test checked exception thrown that did not implement the interface. Since the exceptionDecode requires a base class, I added an extra layer without the interface.
Another solution would be to have a different ErrorDecoder with another exception class hierarchy.
I have no preferences and I am open to suggestion.
| detailMessageField = Throwable.class.getDeclaredField("detailMessage"); | ||
| detailMessageField.setAccessible(true); | ||
| } catch (Exception e) { | ||
| logger.debug("Unable to directly set the detailMessage, make sure exception do implement {}", baseExceptionClass.getName()); |
There was a problem hiding this comment.
i'm not sure debug is enough, while you fixed it so it wont break now, it will break then, and I think debug is not enough in this case
There was a problem hiding this comment.
nvm we just discussed the fact that we now have 2 messages, the warning is still here
To facilitate migration for people transitionning from the version 1 to version 2, the mechanism to set the detail message reflectively has been added back as a fallback mechanism. **This fallback mechanism is only available while running on JDK < 16**.
2da0327 to
616d938
Compare
To facilitate migration for people transitionning from the version 1 to version 2, the mechanism to set the detail message reflectively has been added back as a fallback mechanism. This fallback mechanism is only available while running on JDK < 16.