kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Playwright fetcher didn't report low level HTTP errors correctly (like Connection Refused) (#852)
rodzic
d67c654f37
commit
e461c0b819
|
@ -31,11 +31,12 @@ class JSActionExceptions(Exception):
|
|||
return
|
||||
|
||||
class PageUnloadable(Exception):
|
||||
def __init__(self, status_code, url, screenshot=False):
|
||||
def __init__(self, status_code, url, screenshot=False, message=False):
|
||||
# Set this so we can use it in other parts of the app
|
||||
self.status_code = status_code
|
||||
self.url = url
|
||||
self.screenshot = screenshot
|
||||
self.message = message
|
||||
return
|
||||
|
||||
class EmptyReply(Exception):
|
||||
|
@ -356,7 +357,7 @@ class base_html_playwright(Fetcher):
|
|||
print(str(e))
|
||||
context.close()
|
||||
browser.close()
|
||||
raise PageUnloadable(url=url, status_code=None)
|
||||
raise PageUnloadable(url=url, status_code=None, message=e.message)
|
||||
|
||||
if response is None:
|
||||
context.close()
|
||||
|
|
|
@ -222,8 +222,10 @@ class update_worker(threading.Thread):
|
|||
self.datastore.update_watch(uuid=uuid, update_obj={'last_error': err_text,
|
||||
'last_check_status': e.status_code})
|
||||
except content_fetcher.PageUnloadable as e:
|
||||
# @todo connection-refused ?
|
||||
err_text = "Page request from server didnt respond correctly"
|
||||
if e.message:
|
||||
err_text = "{} - {}".format(err_text, e.message)
|
||||
|
||||
if e.screenshot:
|
||||
self.datastore.save_screenshot(watch_uuid=uuid, screenshot=e.screenshot, as_error=True)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue