OLD | NEW |
(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 ) |
OLD | NEW |