mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
Closes #156791 ## Summary This PR implements catching the error thrown by the saved_objects_exporter when an object is not found, and responding with a detailed 404 ("Not Found") rather than a generic 500 ("Internal Server Error") response message. ### Example Response: ``` { "statusCode": 404, "error": "Not Found", "message": "Saved objects not found", "attributes": { "objects": [ { "id": "7adfa750-4c81-11e8-b3d7-01146121b73d", "type": "dashboard" }, { "id": "571aaf70-4c88-11e8-b3d7-01146121b73d", "type": "search" }, { "id": "d3d7af60-4c81-11e8-b3d7-01146121b73d", "type": "index-pattern" } ] } } ``` ### Testing 1. Install sample flight data, find the id of the flights dashboard SO 2. Create an additional space 'b' 3. Issue a request to copy saved objects to space b ``` POST kbn:/api/spaces/_copy_saved_objects { "spaces": [ "b" ], "objects": [ { "type": "dashboard", "id": "7adfa750-4c81-11e8-b3d7-01146121b73e" }, { "type": "dashboard", "id": "7adfa750-4c81-11e8-b3d7-01146121b73f" }, { "type": "dashboard", "id": "7adfa750-4c81-11e8-b3d7-01146121b73g" } ] } ``` 4. Verify response ``` { "statusCode": 404, "error": "Not Found", "message": "Saved objects not found", "attributes": { "objects": [ { "type": "dashboard", "id": "7adfa750-4c81-11e8-b3d7-01146121b73e" }, { "type": "dashboard", "id": "7adfa750-4c81-11e8-b3d7-01146121b73f" }, { "type": "dashboard", "id": "7adfa750-4c81-11e8-b3d7-01146121b73g" } ] } } ``` 5. Issue a request to copy the flights dashboard SO 6. Verify the usual response (200, missing references) 7. Issue a malformed request to copy an SO 8. Verify status 400 response with details |
||
---|---|---|
.. | ||
actions-and-connectors | ||
alerting | ||
cases | ||
dashboard | ||
data-views | ||
index-patterns | ||
logstash-configuration-management | ||
machine-learning | ||
osquery-manager | ||
role-management | ||
saved-objects | ||
session-management | ||
short-urls | ||
spaces-management | ||
task-manager | ||
upgrade-assistant | ||
actions-and-connectors.asciidoc | ||
alerting.asciidoc | ||
cases.asciidoc | ||
dashboard-api.asciidoc | ||
data-views.asciidoc | ||
features.asciidoc | ||
index-patterns.asciidoc | ||
logstash-configuration-management.asciidoc | ||
machine-learning.asciidoc | ||
osquery-manager.asciidoc | ||
role-management.asciidoc | ||
saved-objects.asciidoc | ||
session-management.asciidoc | ||
short-urls.asciidoc | ||
spaces-management.asciidoc | ||
upgrade-assistant.asciidoc |