Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Organize exception class into better hierarchy #184

Closed
dai-chen opened this issue Sep 17, 2019 · 0 comments
Closed

Organize exception class into better hierarchy #184

dai-chen opened this issue Sep 17, 2019 · 0 comments
Labels
duplicate This issue or pull request already exists maintenance Improves code quality, but not the product

Comments

@dai-chen
Copy link
Member

Proposal: #179 (comment). Currently we have multiple exception classes for different error, such as:

  • SqlParseException
  • ParserException
  • SQLFeatureNotSupportedException
  • SQLFeatureDisabledException
  • VerificationException
  • SqlAnalysisException

It's good to have fine-grained exception but they should be organized into hierarchy with common root. In this case, we don't need to enumerate all of them to decide what HTTP error code should be returned:

    private static boolean isClientError(Exception e) {
        return e instanceof NullPointerException // NPE is hard to differentiate but more likely caused by bad query
            || e instanceof SqlParseException
            || e instanceof ParserException
            || e instanceof SQLFeatureNotSupportedException
            || e instanceof SQLFeatureDisabledException
            || e instanceof IllegalArgumentException
            || e instanceof IndexNotFoundException
            || e instanceof VerificationException
            || e instanceof SqlAnalysisException;
    }
@dai-chen dai-chen added the maintenance Improves code quality, but not the product label Sep 17, 2019
@dai-chen dai-chen added the duplicate This issue or pull request already exists label Dec 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists maintenance Improves code quality, but not the product
Projects
None yet
Development

No branches or pull requests

1 participant