fix(core): name the exception class in a message-less Query catch-all (#3728)

An unhandled exception with no message, such as a NullPointerException on
the native image, rendered as "Unexpected error: null" on the Query wire,
which is what the reporter of #3356 saw. The Query controller and the SQS,
RDS and Neptune handlers now fall back to the exception's class name.

Refs #3356
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-09-16 17:44:38 -05:00
1 parent 3f10acdb95
commit 2b091608af
6 files changed
+39 -4

No files matched your search

@@ -40,6 +40,23 @@ class AwsQueryInternalErrorIntegrationTest {
.body("ErrorResponse.Error.Message", containsString("simulated handler bug"));
}
@Test
void messagelessHandlerExceptionNamesTheExceptionClass() {
// On the native image an NPE carries no message; "Unexpected error: null" is what the
// reporter of #3356 saw. The class name is the least a caller needs to file a report.
when(iamService.listUsers(any())).thenThrow(new NullPointerException());
given()
.formParam("Action", "ListUsers")
.header("Authorization",
"AWS4-HMAC-SHA256 Credential=test/20260227/us-east-1/iam/aws4_request")
.when()
.post("/")
.then()
.statusCode(500)
.body("ErrorResponse.Error.Code", equalTo("InternalFailure"))
.body("ErrorResponse.Error.Message", equalTo("Unexpected error: NullPointerException"));
}
/**
* The catch-all must not swallow AwsException. CloudWatch Metrics is the Query handler that
* renders no error XML of its own, so its AwsException reaches the controller: it has to keep