Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Improve logging and fix CI#21

Merged
jebeaudet merged 6 commits intomaincoveooss/feign-error-decoder:mainfrom
fix/improve-loggingcoveooss/feign-error-decoder:fix/improve-loggingCopy head branch name to clipboard
Apr 26, 2023
Merged

Improve logging and fix CI#21
jebeaudet merged 6 commits intomaincoveooss/feign-error-decoder:mainfrom
fix/improve-loggingcoveooss/feign-error-decoder:fix/improve-loggingCopy head branch name to clipboard

Conversation

@jebeaudet
Copy link
Collaborator

The logging message when not being able to set accessible the detailMessage field was wrong so that's not fixed. The WARN is also not logged when the base exception implements ExceptionMessageSetter.

Formatting has been fixed, last PR didn't run it it seems.

logger.debug("Unable to directly set the detailMessage, make sure exception do implement {}", baseExceptionClass.getName());
logger.debug(
"Unable to set the detailMessage via reflection, make sure the base exception do implement '{}'. Error message: '{}'.",
ExceptionMessageSetter.class.getName(),
Copy link
Contributor

Choose a reason for hiding this comment

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

It's kind of weird that the class takes anything that extends exception (so is meant to be super flexible?). But will displays the ExceptionMessageSetter class name here. We could probably make it less flexible or respect the baseExceptionClass to avoid confusion.

As I think of it, it's a bit weird that ExceptionMessageSetter is kind of the implicit default ? Shouldn't the constructor use ExceptionMessageSetter as the base class if none is provided? (I think would also allow us to simplify some methods)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The class cannot restrict the base exception as it parses exceptions from an interface Class<?> apiClass which cannot be typed and the exception declared on the methods are also out of the control of this class.

The constructor already takes a base exception that is typed (S).

ExceptionMessageSetter is just an interface and a way to get around the new limitations of jdk16+, it's not meant to be a base exception class.

if (!exceptionMessageHandlingLogged
if (detailMessageField == null
&& !exceptionMessageHandlingLogged
&& !ExceptionMessageSetter.class.isAssignableFrom(clazz)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should be BaseExceptionClass here no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, this message is meant to warn the user when his baseExceptionClass does not implement ExceptionMessageSetter and that the reflection trick is not available

}

public static class AdditionalNotInterfacedRuntimeException extends AbstractAdditionalRuntimeException {
public static class AdditionalNotInterfacedRuntimeException
Copy link
Collaborator

Choose a reason for hiding this comment

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

something's up with the formatting no?


public abstract class ServiceException extends BaseServiceException implements ExceptionMessageSetter {
public abstract class ServiceException extends BaseServiceException
implements ExceptionMessageSetter {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here. Why is it on a new line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the formatter is run by the fmt-maven-plugin, my guess is that the previous PR didn't run the formatting before merging?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

okok thanks!

Copy link
Collaborator

@mcnoreau12 mcnoreau12 left a comment

Choose a reason for hiding this comment

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

The formatting looks weirds but otherwise lgtm

@jebeaudet jebeaudet changed the title Improve logging Improve logging and fix CI Apr 26, 2023
@jebeaudet jebeaudet merged commit b5375db into main Apr 26, 2023
@jebeaudet jebeaudet deleted the fix/improve-logging branch April 26, 2023 12:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments

Close sidebar
Morty Proxy This is a proxified and sanitized view of the page, visit original site.