diff --git a/certbot/error_handler.py b/certbot/error_handler.py index 42861b4a1..45d37f847 100644 --- a/certbot/error_handler.py +++ b/certbot/error_handler.py @@ -5,6 +5,7 @@ import os import signal import traceback +from certbot import errors logger = logging.getLogger(__name__) @@ -19,14 +20,6 @@ _SIGNALS = ([signal.SIGTERM] if os.name == "nt" else signal.SIGXCPU, signal.SIGXFSZ]) -class SignalExit(Exception): - """This exception is used stop of execution of the code in the body of the - ErrorHandler context manager. - - """ - pass - - class ErrorHandler(object): """Registers functions to be called if an exception or signal occurs. @@ -62,7 +55,7 @@ class ErrorHandler(object): def __exit__(self, exec_type, exec_value, trace): self.body_executed = True retval = False - if exec_type is SignalExit: + if exec_type is errors.SignalExit: logger.debug("Encountered signals: %s", self.received_signals) self.call_registered() for signum in self.received_signals: @@ -120,7 +113,7 @@ class ErrorHandler(object): """ self.received_signals.append(signum) if not self.body_executed: - raise SignalExit + raise errors.SignalExit def call_signal(self, signum): """Calls the signal given by signum. diff --git a/certbot/errors.py b/certbot/errors.py index 1553b6317..738b7536b 100644 --- a/certbot/errors.py +++ b/certbot/errors.py @@ -29,6 +29,10 @@ class HookCommandNotFound(Error): """Failed to find a hook command in the PATH.""" +class SignalExit(Error): + """A Unix signal was recieved while in the ErrorHandler context manager.""" + + # Auth Handler Errors class AuthorizationError(Error): """Authorization error."""