Skip to content

Account for error.reason === null#228058

Merged
gsoldevila merged 4 commits intoelastic:mainfrom
gsoldevila:reason-can-now-be-null
Jul 18, 2025
Merged

Account for error.reason === null#228058
gsoldevila merged 4 commits intoelastic:mainfrom
gsoldevila:reason-can-now-be-null

Conversation

@gsoldevila
Copy link
Copy Markdown
Contributor

@gsoldevila gsoldevila commented Jul 15, 2025

Summary

Starting on elasticsearch-js 9.0.3, the error.reason field can now be also null.
This PR updates our decorator to account for that case as well.

Related to #226188

@gsoldevila gsoldevila requested a review from a team as a code owner July 15, 2025 15:39
@gsoldevila gsoldevila added Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v9.1.0 labels Jul 15, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-core (Team:Core)

Comment on lines +41 to +43
const { reason: esErrorReason } = get(error, 'body.error', { reason: undefined }) as {
reason?: string | null;
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: this could have been caught in the past if we used a type provided by the ES client.

Maybe ErrorCause instead of the explicit casting to { reason?: string | null }?

@gsoldevila gsoldevila enabled auto-merge (squash) July 17, 2025 08:26
@gsoldevila gsoldevila merged commit b1132c1 into elastic:main Jul 18, 2025
12 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.1

https://github.com/elastic/kibana/actions/runs/16373654244

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 18, 2025
## Summary

Starting on elasticsearch-js `9.0.3`, the `error.reason` field can now
be also `null`.
This PR updates our decorator to account for that case as well.

Related to elastic#226188

(cherry picked from commit b1132c1)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jul 18, 2025
# Backport

This will backport the following commits from `main` to `9.1`:
- [Account for error.reason === null
(#228058)](#228058)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-07-18T14:55:29Z","message":"Account
for error.reason === null (#228058)\n\n## Summary\n\nStarting on
elasticsearch-js `9.0.3`, the `error.reason` field can now\nbe also
`null`.\nThis PR updates our decorator to account for that case as well.
\n\nRelated to
https://github.com/elastic/kibana/pull/226188","sha":"b1132c1f0c2702589a8c6c796062d920ae242c02","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport:version","v9.1.0","v9.2.0"],"title":"Account
for error.reason ===
null","number":228058,"url":"https://github.com/elastic/kibana/pull/228058","mergeCommit":{"message":"Account
for error.reason === null (#228058)\n\n## Summary\n\nStarting on
elasticsearch-js `9.0.3`, the `error.reason` field can now\nbe also
`null`.\nThis PR updates our decorator to account for that case as well.
\n\nRelated to
https://github.com/elastic/kibana/pull/226188","sha":"b1132c1f0c2702589a8c6c796062d920ae242c02"}},"sourceBranch":"main","suggestedTargetBranches":["9.1"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/228058","number":228058,"mergeCommit":{"message":"Account
for error.reason === null (#228058)\n\n## Summary\n\nStarting on
elasticsearch-js `9.0.3`, the `error.reason` field can now\nbe also
`null`.\nThis PR updates our decorator to account for that case as well.
\n\nRelated to
https://github.com/elastic/kibana/pull/226188","sha":"b1132c1f0c2702589a8c6c796062d920ae242c02"}}]}]
BACKPORT-->

Co-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>
Bluefinger pushed a commit to Bluefinger/kibana that referenced this pull request Jul 22, 2025
## Summary

Starting on elasticsearch-js `9.0.3`, the `error.reason` field can now
be also `null`.
This PR updates our decorator to account for that case as well. 

Related to elastic#226188
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
## Summary

Starting on elasticsearch-js `9.0.3`, the `error.reason` field can now
be also `null`.
This PR updates our decorator to account for that case as well. 

Related to elastic#226188
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants