Fix uncaught promise error

main
Elbert Alias 4 years ago
parent 892fe1ac14
commit 4e8cf66677

@ -196,10 +196,11 @@ class Site {
}
timeout() {
return new Promise(() =>
setTimeout(() => {
throw new Error('The website took too long to respond')
}, this.options.maxWait)
return new Promise((resolve, reject) =>
setTimeout(
() => reject(new Error('The website took too long to respond')),
this.options.maxWait
)
)
}
@ -300,7 +301,7 @@ class Site {
try {
await Promise.race([
this.timeout(),
await this.timeout(),
page.goto(url.href, { waitUntil: 'domcontentloaded' })
])
@ -308,8 +309,8 @@ class Site {
// Links
const links = await Promise.race([
this.timeout(),
await (
await this.timeout(),
(
await page.evaluateHandle(() =>
Array.from(document.getElementsByTagName('a')).map(
({ hash, hostname, href, pathname, protocol, rel }) => ({
@ -327,8 +328,8 @@ class Site {
// Script tags
const scripts = await Promise.race([
this.timeout(),
await (
await this.timeout(),
(
await page.evaluateHandle(() =>
Array.from(document.getElementsByTagName('script'))
.map(({ src }) => src)
@ -339,8 +340,8 @@ class Site {
// Meta tags
const meta = await Promise.race([
this.timeout(),
await (
await this.timeout(),
(
await page.evaluateHandle(() =>
Array.from(document.querySelectorAll('meta')).reduce(
(metas, meta) => {
@ -361,8 +362,8 @@ class Site {
// JavaScript
const js = await Promise.race([
this.timeout(),
await page.evaluate(
await this.timeout(),
page.evaluate(
(technologies) => {
return technologies.reduce((technologies, { name, chains }) => {
chains.forEach((chain) => {
@ -441,8 +442,8 @@ class Site {
if (!this.language) {
this.language = await Promise.race([
this.timeout(),
await (
await this.timeout(),
(
await page.evaluateHandle(
() =>
document.documentElement.getAttribute('lang') ||

@ -13,7 +13,7 @@
"software"
],
"homepage": "https://www.wappalyzer.com",
"version": "6.2.0",
"version": "6.2.2",
"author": "Wappalyzer",
"license": "MIT",
"repository": {
@ -38,4 +38,4 @@
"languagedetect": "^2.0.0",
"puppeteer": "^2.0.0"
}
}
}

@ -131,6 +131,7 @@ const Popup = {
for (const el of document.querySelectorAll('.footer__switch')) {
el.classList.add('footer__switch--hidden')
}
document.querySelector('.alerts').classList.add('alerts--hidden')
}
}

@ -4,7 +4,7 @@
"author": "Wappalyzer",
"homepage_url": "https://www.wappalyzer.com",
"description": "Identify web technologies",
"version": "6.2.0",
"version": "6.2.1",
"default_locale": "en",
"manifest_version": 2,
"icons": {

@ -13,7 +13,7 @@
"software"
],
"homepage": "https://www.wappalyzer.com",
"version": "6.2.0",
"version": "6.2.2",
"author": "Wappalyzer",
"license": "MIT",
"repository": {
@ -27,4 +27,4 @@
"files": [
"wappalyzer.js"
]
}
}