| tierno | 0aef0db | 2018-02-01 19:13:07 +0100 | [diff] [blame^] | 1 | |
| 2 | from http import HTTPStatus |
| 3 | |
| 4 | |
| 5 | class MsgException(Exception): |
| 6 | """ |
| 7 | Base Exception class for all msgXXXX exceptions |
| 8 | """ |
| 9 | |
| 10 | def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR): |
| 11 | """ |
| 12 | General exception |
| 13 | :param message: descriptive text |
| 14 | :param http_code: <http.HTTPStatus> type. It contains ".value" (http error code) and ".name" (http error name |
| 15 | """ |
| 16 | self.http_code = http_code |
| 17 | Exception.__init__(self, message) |
| 18 | |
| 19 | |
| 20 | class MsgBase(object): |
| 21 | """ |
| 22 | Base class for all msgXXXX classes |
| 23 | """ |
| 24 | |
| 25 | def __init__(self): |
| 26 | pass |
| 27 | |
| 28 | def connect(self, config): |
| 29 | pass |
| 30 | |
| 31 | def write(self, msg): |
| 32 | pass |
| 33 | |
| 34 | def read(self): |
| 35 | pass |
| 36 | |
| 37 | def disconnect(self): |
| 38 | pass |
| 39 | |