Skip to content

Improve error messages in ErrorResponseExceptionMapper#110

Merged
ruhan1 merged 4 commits intoCommonjava:mainfrom
ruhan1:fix-error-response-mapper-messages
Mar 16, 2026
Merged

Improve error messages in ErrorResponseExceptionMapper#110
ruhan1 merged 4 commits intoCommonjava:mainfrom
ruhan1:fix-error-response-mapper-messages

Conversation

@ruhan1
Copy link
Copy Markdown
Contributor

@ruhan1 ruhan1 commented Mar 16, 2026

Summary

  • Replace generic "Unknown error" messages with detailed HTTP 500 error diagnostics
  • Include HTTP status code, response headers, and status info in exception messages
  • Helps debug backend service failures by exposing correlation IDs and diagnostic information in logs

Problem

When the content service returns HTTP 500 errors with empty response bodies, the current error mapper throws a generic WebApplicationException: Unknown error which provides no useful debugging information.

Solution

Enhanced the ErrorResponseExceptionMapper to include:

  • HTTP status code in all exceptions
  • Response headers (which may contain correlation IDs, trace IDs, server info)
  • Response status info
  • Actual error body when available
  • Clear error messages indicating the failure type

🤖 Generated with Claude Code

Replace generic "Unknown error" messages with detailed HTTP 500 error information including status codes, response headers, and status info. This helps with debugging when backend services fail by providing correlation IDs and other diagnostic information in the logs.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ruhan1 ruhan1 force-pushed the fix-error-response-mapper-messages branch from b4bac4a to 2a22527 Compare March 16, 2026 03:32
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ruhan1 ruhan1 force-pushed the fix-error-response-mapper-messages branch from 2a22527 to 39e612b Compare March 16, 2026 09:33
- Update toolchains plugin to use Java 17
- Add Java 17 toolchain to toolchains.xml
- Add JVM arguments to cassandra-maven-plugin for Java 17 support
- Add required --add-exports and --add-opens flags for Cassandra 3.x

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ruhan1 ruhan1 force-pushed the fix-error-response-mapper-messages branch from d32eed4 to b1c8457 Compare March 16, 2026 09:45
- Remove cassandra-maven-plugin which doesn't support Java 17
- Add Testcontainers Cassandra dependency for test containers
- Create CassandraTestResource to manage Cassandra container lifecycle
- Add init-keyspace.cql for keyspace initialization
- Register CassandraTestResource globally via service loader
- Simplify test configuration in application.yaml

This modern approach uses Docker containers instead of embedded Cassandra,
providing better Java 17 compatibility and more reliable test execution.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ruhan1 ruhan1 merged commit 134e6c3 into Commonjava:main Mar 16, 2026
1 check passed
@ruhan1 ruhan1 deleted the fix-error-response-mapper-messages branch March 16, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant