Skip to content
Advertisement

SonarQube complains: Either log or rethrow this exception

I am running SonarQube 5 for code quality check after integrating the code with Maven.

Sonar is complaining that I should:

Either log or rethrow this exception.

in following piece of code:

JavaScript

What am I missing here?

Advertisement

Answer

First of all, is this behaviour correct? Seems a bit weird that you are trying to call convertStringtoDate on the exception message as well.

Secondly, I had the same problem with Sonar recently. Seems like you need to pass the whole exception as a parameter to the logger, instead of e.getMessage() for Sonar to realize you are logging the exception.

Try this instead:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement