Skip to content

Output a consistent format when generating error json #90529

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

Merged
merged 39 commits into from
Nov 19, 2024

Conversation

thecoop
Copy link
Member

@thecoop thecoop commented Sep 29, 2022

Now, error fields will always have 'type' and 'reason' fields, and the information in those fields is the same regardless of whether the output is detailed or not. This also reverses the test changes in #116330, due to the deprecation warning not (generally) being there anymore.

This fixes #89387

Now, error fields will always have 'type' and 'reason' fields, and the information in those fields is the same regardless of whether the output is detailed or not
@thecoop thecoop added >bug :Core/Infra/REST API REST infrastructure and utilities labels Sep 29, 2022
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine elasticsearchmachine added Team:Core/Infra Meta label for core/infra team v8.6.0 labels Sep 29, 2022
@elasticsearchmachine
Copy link
Collaborator

Hi @thecoop, I've created a changelog YAML for you.

@thecoop
Copy link
Member Author

thecoop commented Sep 29, 2022

Note this does have some BwC concerns, as this changes the output format when not detailed, but from #89387 we consider the current behaviour a bug

@thecoop thecoop marked this pull request as draft September 29, 2022 15:56
@thecoop thecoop marked this pull request as ready for review September 30, 2022 10:17
@elasticsearchmachine
Copy link
Collaborator

Hi @thecoop, I've updated the changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Hi @thecoop, I've updated the changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Hi @thecoop, I've updated the changelog YAML for you. Note that since this PR is labelled >breaking, you need to update the changelog YAML to fill out the extended information sections.

@ChrisHegarty
Copy link
Contributor

This PR is marked as a "breaking" change. Is it really a breaking change?

@elasticsearchmachine
Copy link
Collaborator

Hi @thecoop, I've updated the changelog YAML for you. Note that since this PR is labelled >breaking, you need to update the changelog YAML to fill out the extended information sections.

Copy link
Contributor

@ldematte ldematte left a comment

Choose a reason for hiding this comment

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

One minor nit, but it looks good to me!

@thecoop
Copy link
Member Author

thecoop commented Nov 14, 2024

@elasticmachine rerun elasticsearch-ci/part-1

@thecoop
Copy link
Member Author

thecoop commented Nov 18, 2024

@elasticmachine update branch

Copy link
Contributor

@mosche mosche left a comment

Choose a reason for hiding this comment

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

LGTM, just one optional thought / questions

@@ -146,12 +147,12 @@ public RestResponse(RestChannel channel, RestStatus status, Exception e) throws
params = new ToXContent.DelegatingMapParams(singletonMap(REST_EXCEPTION_SKIP_STACK_TRACE, "false"), params);
}

if (channel.detailedErrorsEnabled() == false) {
if (channel.request().getRestApiVersion() == RestApiVersion.V_8 && channel.detailedErrorsEnabled() == false) {
deprecationLogger.warn(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this change to critical now?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so, there's (probably) nothing directly for users to do; we consider the existing behaviour a bug, as it's surprising the format changes with non-detailed errors.

@thecoop thecoop merged commit b30a4b2 into elastic:main Nov 19, 2024
16 checks passed
@thecoop thecoop deleted the exception-json branch November 19, 2024 13:35
rjernst pushed a commit to rjernst/elasticsearch that referenced this pull request Nov 20, 2024
Now, error fields will always have 'type' and 'reason' fields, and the information in those fields is the same regardless of whether the output is detailed or not
alexey-ivanov-es pushed a commit to alexey-ivanov-es/elasticsearch that referenced this pull request Nov 28, 2024
Now, error fields will always have 'type' and 'reason' fields, and the information in those fields is the same regardless of whether the output is detailed or not
@samxbr
Copy link
Contributor

samxbr commented Mar 17, 2025

Friendly reminder that this PR seems to be a breaking change for 9.0, but is missing from the 9.0 release note. We may want to add an entry to the breaking change section of 9.0 release note.

@thecoop
Copy link
Member Author

thecoop commented Mar 24, 2025

See #125485

brianseeders added a commit to brianseeders/elasticsearch that referenced this pull request Apr 2, 2025
@leemthompo
Copy link
Contributor

@thecoop is this PR relevant to the serverless changelog? [FYI this question is based on 9.0 breaking changes]

@thecoop
Copy link
Member Author

thecoop commented Apr 14, 2025

No, this option is not relevant for serverless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking >bug :Core/Infra/REST API REST infrastructure and utilities Team:Core/Infra Meta label for core/infra team v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Solidify & document guarantees about structure of error responses