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

[#5105] improvement(server,client): Error code optimization about access control API #5144

Merged
merged 3 commits into from
Oct 18, 2024

Conversation

jerqi
Copy link
Collaborator

@jerqi jerqi commented Oct 15, 2024

What changes were proposed in this pull request?

Error code optimization about access control API

Why are the changes needed?

Fix: #5105

Does this PR introduce any user-facing change?

Yes.

How was this patch tested?

Modify some UTs

@jerqi jerqi marked this pull request as draft October 15, 2024 09:11
@jerqi jerqi self-assigned this Oct 15, 2024
@jerqi jerqi closed this Oct 15, 2024
@jerqi jerqi reopened this Oct 15, 2024
@jerqi jerqi closed this Oct 15, 2024
@jerqi jerqi reopened this Oct 15, 2024
@jerqi jerqi requested a review from yuqi1129 October 15, 2024 11:14
@jerqi jerqi marked this pull request as ready for review October 15, 2024 11:14
import com.google.errorprone.annotations.FormatString;

/** An exception thrown when a metadata object is invalid. */
public class IllegalMetadataObjectException extends IllegalArgumentException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you define "illegal"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a metadata object in the path doesn't exist, we will return NotFoundException.
If a metadata object in the request body doesn't exist, we will return IllegalException.

new UserResponse(
DTOConverters.toDTO(
accessControlManager.grantRolesToUser(
metalake, request.getRoleNames(), user)))))));
metalake, request.getRoleNames(), user))));
} catch (NoSuchRoleException nsr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to handle IllegalRoleException in the core, not convert to this exception in here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK , just in my view, I usually throw IllegalxxxException in the other Operation class. It's ok to throw in the core module.

@jerryshao jerryshao merged commit 6272303 into apache:main Oct 18, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement] Error code optimization about access control API
2 participants