From b0e31340b4551d997a8895fd9294b253ddf69dc5 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 16 Mar 2019 17:16:51 +0100 Subject: browser: Raise exception if navigation failed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stop early if there’s nothing to do. --- crocoite/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crocoite/cli.py') diff --git a/crocoite/cli.py b/crocoite/cli.py index 0595eb9..fb9060d 100644 --- a/crocoite/cli.py +++ b/crocoite/cli.py @@ -32,7 +32,7 @@ try: except ModuleNotFoundError: pass -from . import behavior +from . import behavior, browser from .controller import SinglePageController, \ ControllerSettings, StatsHandler, LogHandler, \ RecursiveController, DepthLimit, PrefixLimit @@ -47,6 +47,7 @@ class SingleExitStatus(IntEnum): Ok = 0 Fail = 1 BrowserCrash = 2 + Navigate = 3 def single (): parser = argparse.ArgumentParser(description='Save website to WARC using Google Chrome.') @@ -90,6 +91,8 @@ def single (): except asyncio.CancelledError: # don’t log this one pass + except browser.NavigateError: + ret = SingleExitStatus.Navigate except Exception as e: ret = SingleExitStatus.Fail logger.error ('cli exception', -- cgit v1.2.3