Add ability to error out of link checking with a predefined interrupt exception.

This commit is contained in:
Bastian Kleineidam 2009-03-07 10:15:14 +01:00
parent 59ffbd43f0
commit 475e40b599
2 changed files with 6 additions and 1 deletions

View file

@ -76,6 +76,9 @@ class LinkCheckerError (StandardError):
"""Exception to be raised on linkchecker-specific check errors."""
pass
class LinkCheckerInterrupt (StandardError):
"""Used for testing."""
pass
def add_intern_pattern (url_data, config):
"""Add intern URL regex to config."""

View file

@ -20,7 +20,7 @@ Management of checking a queue of links with several threads.
import time
import os
import thread
from .. import log, LOG_CHECK
from .. import log, LOG_CHECK, LinkCheckerInterrupt
from ..cache import urlqueue, robots_txt, cookie, connection
from . import aggregator, console
@ -37,6 +37,8 @@ def check_urls (aggregate):
check_url(aggregate)
aggregate.finish()
aggregate.logger.end_log_output()
except LinkCheckerInterrupt:
raise
except KeyboardInterrupt:
interrupt(aggregate)
except thread.error: