Log expected route-handler not-found at debug instead of error#1771
Open
muk2 wants to merge 1 commit into
Open
Log expected route-handler not-found at debug instead of error#1771muk2 wants to merge 1 commit into
muk2 wants to merge 1 commit into
Conversation
A snapshotGet (and any other route) that returns a `notFound` ContainerizationError is an expected, recoverable outcome: the client catches it and unpacks the image. Logging it via the generic XPC route dispatcher at `error` level produced a misleading log line such as `handler for snapshotGet threw error notFound: "image snapshot for ref"`. Downgrade `notFound` results to `debug` in the route handler error path while still replying with the error so clients can act on it. The decision is factored into `ContainerizationError.routeHandlerLogLevel` so it can be unit tested on platforms that cannot build the macOS-only XPC server. Fixes apple#589
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
Logs an expected
notFoundresult from an XPC route handler atdebuginsteadof
error. Looking up a resource that does not yet exist (for example, asnapshot before it has been unpacked) is a normal, recoverable outcome, but it
was being logged as
handler for snapshotGet threw error notFound, which ismisleading. The error is still returned to the client unchanged; only the
server-side log level is lowered. All other error codes continue to log at
error.Testing
make checkpasses (formatting + license headers).RouteHandlerLogLevelTests(2 tests, in a newContainerXPCTeststarget) assert
notFoundmaps todebugand other codes map toerror. All pass.Fixes #589