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

Refactor error message handling #2001

Open
Yury-Fridlyand opened this issue Aug 21, 2023 · 0 comments
Open

Refactor error message handling #2001

Yury-Fridlyand opened this issue Aug 21, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Yury-Fridlyand
Copy link
Collaborator

What to change

  • ErrorMessageFactory
  • ErrorMessage
  • OpenSearchErrorMessage

Reason

  1. Those classes are duplicated - in :legacy for SQL and in :opensearch for PPL.
  2. They are referred in two places:
    1. in ResponseFormatters in :protocol to format an exception, but this code never used
    2. in RestPPLQueryAction in :plugin to format a error for PPL and in RestSqlAction in :legacy to format a error in SQL
  3. These classes add a dependency between :protocol and :opensearch.

Purpose

  1. Break the dependency - this is needed for [FEATURE] Make OpenSearch function registered dynamically #811 (UDF = user defined functions)
  2. Use formatters to format an exception

How to

  1. Let OpenSearchExecutionEngine to extract data from OpenSearchErrorMessage and build a regular exception.
  2. Move ErrorMessage to :protocol.
  3. Delete ErrorMessageFactory since it is not needed anymore; copy unwrapCause to ErrorMessage.
  4. See example in e66e6b9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants