destroy session for all error

This commit is contained in:
spiduler
2021-01-18 12:13:59 +09:00
parent 8c6616c8bd
commit cb7da3daf3
2 changed files with 3 additions and 9 deletions

View File

@@ -21,10 +21,8 @@ class SeleniumBrowser {
.then(() => driver.findElement(By.css('body')))
.then(body => body.getAttribute('innerHTML'))
.catch(e => {
if (e instanceof NoSuchSessionError) {
this.pool.destroy(driver)
throw new NoSuchSessionError
}
this.pool.destroy(driver)
throw new Error(e.message)
})
let p = captcha.isCaptchaPage(html) ? captcha.resolveCaptcha(driver, this.pool) : this.getHtml(driver, html, params)
html = await p