-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] use defaultFleetErrorHandler in all fleet routes #200741
[Fleet] use defaultFleetErrorHandler in all fleet routes #200741
Conversation
2c7400c
to
96e0366
Compare
96e0366
to
bcf1f17
Compare
Pinging @elastic/fleet (Team:Fleet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great refactor!
Should we document the usage somewhere, at least in code comments?
Probably worth adding a section about our fleet_router in Fleet readme, I will made that change |
@juliaElastic @kpollich do you think this should be backported to 8.x? |
It sounds like a small risk change, so I would vote to backport. |
💚 Build Succeeded
Metrics [docs]
cc @nchaulet |
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11919725447 |
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
) (cherry picked from commit 523fd13) # Conflicts: # x-pack/plugins/fleet/server/routes/agent/handlers.ts # x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts # x-pack/plugins/fleet/server/routes/app/index.ts # x-pack/plugins/fleet/server/routes/epm/handlers.ts # x-pack/plugins/fleet/server/routes/health_check/handler.ts # x-pack/plugins/fleet/server/routes/settings/enrollment_settings_handler.ts # x-pack/plugins/fleet/server/routes/uninstall_token/handlers.ts
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…) (#200803) # Backport This will backport the following commits from `main` to `8.x`: - [[Fleet] use defaultFleetErrorHandler in all fleet routes (#200741)](#200741) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Nicolas Chaulet","email":"nicolas.chaulet@elastic.co"},"sourceCommit":{"committedDate":"2024-11-19T18:49:44Z","message":"[Fleet] use defaultFleetErrorHandler in all fleet routes (#200741)","sha":"523fd13925cd0ec4f02f9ac069b09153e36fb9e0","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-minor"],"number":200741,"url":"https://github.com/elastic/kibana/pull/200741","mergeCommit":{"message":"[Fleet] use defaultFleetErrorHandler in all fleet routes (#200741)","sha":"523fd13925cd0ec4f02f9ac069b09153e36fb9e0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200741","number":200741,"mergeCommit":{"message":"[Fleet] use defaultFleetErrorHandler in all fleet routes (#200741)","sha":"523fd13925cd0ec4f02f9ac069b09153e36fb9e0"}}]}] BACKPORT-->
Summary
Resolve #197518
To handle Fleet error with have a handler
defaultFleetErrorHandler
that transform known error into specific response with specific statusCode.That PR make a change to use
defaultFleetErrorHandler
in all fleet registered route instead of having to manually add a try/catch in every fleet handler, so we do not forget to handle some errors.Should we backport this to
8.x
?