dukbong opened a new issue, #1779:
URL: https://github.com/apache/hertzbeat/issues/1779
### Question
```java
public static String getMessageFromThrowable(Throwable throwable) {
if (throwable == null) {
return "throwable is null, unknown error.";
}
String message = null;
Throwable cause = throwable.getCause();
if (cause != null) {
message = cause.getMessage();
}
if (message == null || "".equals(message)) {
message = throwable.getMessage();
}
if (message == null || "".equals(message)) {
message = throwable.getLocalizedMessage();
}
if (message == null || "".equals(message)) {
message = throwable.toString();
}
if (message == null || "".equals(message)) {
message = "unknown error.";
}
return message;
}
```
I'm curious about the intention behind the conditional statement, as
ultimately, if 'message' is null, it ends up containing 'unknown error'. I was
planning to remove the conditional statement through this PR, but I wanted to
ask if it might have been created for future use or another purpose.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]