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

fix verbose error message thrown by invalid enum #167

Merged
merged 1 commit into from
Mar 7, 2022

Conversation

ylwu-amzn
Copy link
Collaborator

@ylwu-amzn ylwu-amzn commented Mar 5, 2022

Signed-off-by: Yaliang Wu ylwu@amazon.com

Description

  1. Don't return verbose error message when use input invalid enum.
  2. Fix some code style

Test:

POST /_plugins/_ml/_train/kmeans
{
    "parameters": {
        "k": 2,
        "iterations": 10,
        "distance_type": "SINE"
    },
    "input_query": {
        "query": {
            "bool": {
                "filter": [
                    {
                        "range": {
                            "k1": {
                                "gte": 0
                            }
                        }
                    }
                ]
            }
        },
        "size": 10
    },
    "input_index": [
        "test_data"
    ]
}

# Response
{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "Wrong distance type"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "Wrong distance type"
    },
    "status": 400
}

Issues Resolved

Close #163

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@ylwu-amzn ylwu-amzn requested a review from a team March 5, 2022 06:23
@ylwu-amzn ylwu-amzn merged commit 0bc8740 into opensearch-project:main Mar 7, 2022
Copy link
Collaborator

@Zhangxunmt Zhangxunmt left a comment

Choose a reason for hiding this comment

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

lgtm

@ylwu-amzn ylwu-amzn added the bug Something isn't working label Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Don't return verbose error message
3 participants