Skip to content

Refactor error message handling #2001

Open
@Yury-Fridlyand

Description

@Yury-Fridlyand

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions