Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/exceptions.py

Issue 29912588: Issue 7019 - [CMS] Refactor `test_server.py` (Closed)
Patch Set: Added timeout option when setting up server Created Oct. 24, 2018, 3:57 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cms/bin/test_server.py ('k') | tests/conftest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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),
+ )
« no previous file with comments | « cms/bin/test_server.py ('k') | tests/conftest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld