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

Reduce logging of known+handled cases #472

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,21 @@ public <T extends Command> Uni<CommandResult> processCommand(
return operation.execute(queryExecutor);
})

// handler failures here
// handle failures here
.onFailure()
.recoverWithItem(
t -> {
logger.warn(
"The command {} failed with exception", command.getClass().getSimpleName(), t);
// DocsException is supplier of the CommandResult
// so simply return
if (t instanceof JsonApiException jsonApiException) {
// Note: JsonApiException means that JSON API itself handled the situation
// (created, or wrapped the exception) -- should not be logged (have already
// been logged if necessary)
return jsonApiException;
}

// otherwise use generic for now
// But other exception types are unexpected, so log for now
logger.warn(
"Command '{}' failed with exception", command.getClass().getSimpleName(), t);
return new ThrowableCommandResultSupplier(t);
})

Expand Down