@opentermsarchive/engine 10.3.1 → 10.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentermsarchive/engine",
3
- "version": "10.3.1",
3
+ "version": "10.3.2",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://opentermsarchive.org",
6
6
  "bugs": {
@@ -35,15 +35,16 @@ export async function extractFromHTML(sourceDocument) {
35
35
  const filteredDOM = await filter(webPageDOM, sourceDocument);
36
36
  const cleanedDOM = filteredDOM.remove(insignificantContentSelectors);
37
37
  const selectedDOM = cleanedDOM.select(contentSelectors);
38
+ const contentSelectorsDisplay = typeof contentSelectors === 'object' ? JSON.stringify(contentSelectors) : contentSelectors;
38
39
 
39
40
  if (!selectedDOM?.children.length) {
40
- throw new Error(`The provided selector "${contentSelectors}" has no match in the web page at '${location}'. This could be due to elements being removed before content selection if "remove" and "select" selectors match the same content.`);
41
+ throw new Error(`The provided selector "${contentSelectorsDisplay}" has no match in the web page at '${location}'. This could be due to elements being removed before content selection if "remove" and "select" selectors match the same content.`);
41
42
  }
42
43
 
43
44
  const markdownContent = transformFromHTML(selectedDOM);
44
45
 
45
46
  if (!markdownContent) {
46
- throw new Error(`The provided selector "${contentSelectors}" matches an empty content in the web page at '${location}'`);
47
+ throw new Error(`The provided selector "${contentSelectorsDisplay}" matches an empty content in the web page at '${location}'`);
47
48
  }
48
49
 
49
50
  return markdownContent;