Index: cms/exceptions.py |
diff --git a/cms/exceptions.py b/cms/exceptions.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d28a0f4280fdf91a68938c8f922e46d9783fdd79 |
--- /dev/null |
+++ b/cms/exceptions.py |
@@ -0,0 +1,53 @@ |
+# This file is part of the Adblock Plus web scripts, |
+# Copyright (C) 2006-present eyeo GmbH |
+# |
+# Adblock Plus is free software: you can redistribute it and/or modify |
+# it under the terms of the GNU General Public License version 3 as |
+# published by the Free Software Foundation. |
+# |
+# Adblock Plus is distributed in the hope that it will be useful, |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+# GNU General Public License for more details. |
+# |
+# You should have received a copy of the GNU General Public License |
+# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
+ |
+ |
+class TimeoutException(Exception): |
+ """Error raised when a timeout occurred. |
+ |
+ Parameters |
+ ---------- |
+ msg: str |
+ The message to be contained by the exception. |
+ |
+ """ |
+ |
+ def __init__(self, msg): |
+ super(TimeoutException, self).__init__(msg) |
+ |
+ |
+class ServerSetupTimeoutException(TimeoutException): |
+ """Error raised when a timeout occured while trying to startup a server. |
+ |
+ Parameters |
+ ---------- |
+ host: str |
+ Host where the server was intended to be setup. |
+ port: int |
+ Port where the server was intended to be setup. |
+ time: float |
+ Time after which the exception was raised. |
+ err: Exception |
+ That caused the server not being able to be setup. |
+ |
+ """ |
+ |
+ _MSG_BASE = ('Setting up a server at {0}, port number {1} failed after {' |
+ '2} seconds! Original exception was: "{3}".') |
+ |
+ def __init__(self, host, port, time, err): |
+ super(ServerSetupTimeoutException, self).__init__( |
+ self._MSG_BASE.format(host, port, time, err), |
+ ) |