Skip to content
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

Improve NessieError message #6874

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions api/model/src/main/java/org/projectnessie/error/NessieError.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,21 @@ default String getFullMessage() {
StringBuilder sb = new StringBuilder();
sb.append(getReason()).append(" (HTTP/").append(getStatus()).append(')');
sb.append(": ");
sb.append(getMessage());
String serverMessage = getMessage();
if (serverMessage == null) {
serverMessage = "[no error message found in HTTP response]";
}
sb.append(serverMessage);

if (getServerStackTrace() != null) {
sb.append("\n").append(getServerStackTrace());
}

if (getClientProcessingException() != null) {
StringWriter sw = new StringWriter();
StringWriter sw =
new StringWriter()
.append(
"\nAdditionally, the client-side exception below was caught while decoding the HTTP response:\n");
getClientProcessingException().printStackTrace(new PrintWriter(sw));
sb.append("\n").append(sw);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void fullMessage() {
+ "[)]: message\\R"
+ "foo.bar.InternalServerError\\R"
+ "\tat some.other.Class\\R"
+ "\\RAdditionally, the client-side exception below was caught while decoding the HTTP response:\\R"
+ "java.lang.Exception: processingException\\R"
+ "\tat (all//)?org.projectnessie.error.TestNessieError.fullMessage[(]TestNessieError.java:"
+ ".*",
Expand Down