Skip to content

Commit

Permalink
Reduce logging of known+handled cases (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
tatu-at-datastax authored Jul 26, 2023
1 parent 882d0e2 commit 5364d5b
Showing 1 changed file with 7 additions and 5 deletions.
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

0 comments on commit 5364d5b

Please sign in to comment.