-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
KAFKA-8866; Return exceptions as Optional<ApiException> in authorizer API #7294
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, just one question below.
*/ | ||
public ApiException exception() { | ||
return exception; | ||
public Optional<ApiException> exception() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is failed()
below still useful enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ijuma Thanks for the review. Agree failed()
is unnecessary, removed.
@@ -44,8 +46,8 @@ private AclDeleteResult(Collection<AclBindingDeleteResult> deleteResults, ApiExc | |||
/** | |||
* Returns any exception while attempting to match ACL filter to delete ACLs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update this javadoc in the same way you did the AclCreateResult
one?
if (result.failed) { | ||
println(s"Error while adding ACLs: ${result.exception.getMessage}") | ||
println(Utils.stackTrace(result.exception)) | ||
result.exception.ifPresent { exception => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this doesn't work with Scala 2.11. You probably have to convert to the Scala option before you can use lambdas. There are utility methods for that in scala-java8-compat
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ijuma Thank you, updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rajinisivaram Thanks for the PR. LGTM.
public ApiException exception() { | ||
return exception; | ||
public Optional<ApiException> exception() { | ||
return exception == null ? Optional.empty() : Optional.of(exception); | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove deleted() also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@omkreddy Thanks for the review. Makes sense, removed deleted()
as well.
Follow up on review comment in PR #7268
Committer Checklist (excluded from commit message)