From b184978f1ff592b0105c305a4fcbb7e6e7ec6f17 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Thu, 12 Dec 2019 14:24:17 -0700 Subject: [PATCH] [Reporting/Screenshots] add error for no shared items found on the page (#52022) (#52946) * [Reporting/Screenshots] add error for no shared items container found on the page * wording adjustment --- .../common/lib/screenshots/get_element_position_data.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_element_position_data.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_element_position_data.ts index 927cf9ec7d80..ce51dc2317c7 100644 --- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_element_position_data.ts +++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/get_element_position_data.ts @@ -47,5 +47,11 @@ export const getElementPositionAndAttributes = async ( args: [layout.selectors.screenshot, { title: 'data-title', description: 'data-description' }], }); + if (elementsPositionAndAttributes.length === 0) { + throw new Error( + `No shared items containers were found on the page! Reporting requires a container element with the '${layout.selectors.screenshot}' attribute on the page.` + ); + } + return elementsPositionAndAttributes; };