apache / apache/gravitino

[Improvement] too many duplicated code in Gravitino error handler

Open
#5,687 4 comments 0 reactions 0 assignees View on GitHub
improvement
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 15h
Merged PRs (30d)
315

Description

### What would you like to be improved?

There are many duplicated code in error handler in both server side and client side, we can move the general exception handling in `BaseExceptionHandler`
```java
if (e instanceof IllegalArgumentException) {
return Utils.illegalArguments(errorMsg, e);

} else if (e instanceof NotFoundException) {
return Utils.notFound(errorMsg, e);

} else if (e instanceof NotInUseException) {
return Utils.notInUse(errorMsg, e);

} else {
return super.handle(op, credential, parent, e);
}
```

### How should we improve?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating BaseExceptionHandler and the duplicated error-handling paths on both the server and client sides. Compare their handling of IllegalArgumentException, NotFoundException, and NotInUseException with the shown Utils calls. Done means the general handling is centralized without changing the existing responses or fallback behavior; run the relevant error-handler tests if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.