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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cms/bin/test_server.py ('k') | tests/conftest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH
3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation.
7 #
8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
15
16
17 class TimeoutException(Exception):
18 """Error raised when a timeout occurred.
19
20 Parameters
21 ----------
22 msg: str
23 The message to be contained by the exception.
24
25 """
26
27 def __init__(self, msg):
28 super(TimeoutException, self).__init__(msg)
29
30
31 class ServerSetupTimeoutException(TimeoutException):
32 """Error raised when a timeout occured while trying to startup a server.
33
34 Parameters
35 ----------
36 host: str
37 Host where the server was intended to be setup.
38 port: int
39 Port where the server was intended to be setup.
40 time: float
41 Time after which the exception was raised.
42 err: Exception
43 That caused the server not being able to be setup.
44
45 """
46
47 _MSG_BASE = ('Setting up a server at {0}, port number {1} failed after {'
48 '2} seconds! Original exception was: "{3}".')
49
50 def __init__(self, host, port, time, err):
51 super(ServerSetupTimeoutException, self).__init__(
52 self._MSG_BASE.format(host, port, time, err),
53 )
OLDNEW
« 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