Conversation
ApplicationExceptionMapper logged every exception at ERROR, including those mapped to 4xx client responses (NotFoundException -> 404, ConflictException -> 409, and similar). These are expected, handled client-side conditions; logging them at ERROR pollutes server error logs and hides genuine 5xx server-side failures. Compute the mapped HttpStatus before logging and emit 4xx at WARN, reserving ERROR for 5xx and unmapped exceptions (which fall back to 500). Add a regression test asserting mapped 4xx responses (409 and 404) are logged at WARN, never ERROR, while the existing 500 test continues to assert ERROR. Closes conductor-oss#1045
gaurav0107
force-pushed
the
fix/1045-conductor-rest-logs-client-side-4xx-exce
branch
from
July 1, 2026 21:15
0b22a1e to
339ed81
Compare
gaurav0107
marked this pull request as ready for review
July 1, 2026 21:16
v1r3n
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ApplicationExceptionMapperin therestmodule logged every exception atERRORvialogException, including exceptions that map to 4xx clientresponses —
NotFoundException(404),ConflictException(409),IllegalArgumentException(400),AccessForbiddenException(403),NoResourceFoundException(404). These are expected, recoverable client-sideconditions that Conductor already handled correctly, so logging them at
ERRORpollutes server error logs and makes genuine 5xx server-side failuresharder to spot. For example, every attempt to create an already-existing
resource emits an
ERRORentry even though the handled result is a 409.This change computes the mapped
HttpStatusbefore logging and selects thelog level from the status class:
WARN500), remain atERRORThe status mapping, response body, and the
Monitors.error(...)metric areunchanged; only the log level for 4xx responses changes. The log message
template and argument order are identical in both branches, so existing log
parsing is unaffected.
Closes #1045
Tests
Extended
ApplicationExceptionMapperTest(JUnit 4 + Mockito + MockMvc):testException(genericException-> 500) is unchanged and still assertsERROR-level logging.testClientErrorLoggedAtWarnthrowsConflictException(-> 409) and assertsthe mapper returns 409 and logs at
WARN, neverERROR.loggeris a shared static mock in this test class, so@Beforenow clearsits invocation history to keep the two tests order-independent.
The change was written against the source and hand-formatted to match the
module's existing
googleJavaFormat().aosp()style; CI validates the build,tests, and Spotless formatting.