blob: a1054146071c05d8379d5ec5eca6730f5165c049 [file] [log] [blame]
tierno0aef0db2018-02-01 19:13:07 +01001
2from http import HTTPStatus
3
tiernoae501922018-02-06 23:17:16 +01004__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
5
tierno0aef0db2018-02-01 19:13:07 +01006
7class MsgException(Exception):
8 """
9 Base Exception class for all msgXXXX exceptions
10 """
11
12 def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR):
13 """
14 General exception
15 :param message: descriptive text
16 :param http_code: <http.HTTPStatus> type. It contains ".value" (http error code) and ".name" (http error name
17 """
18 self.http_code = http_code
tiernoae501922018-02-06 23:17:16 +010019 Exception.__init__(self, "messaging exception " + message)
tierno0aef0db2018-02-01 19:13:07 +010020
21
22class MsgBase(object):
23 """
24 Base class for all msgXXXX classes
25 """
26
27 def __init__(self):
28 pass
29
30 def connect(self, config):
31 pass
32
33 def write(self, msg):
34 pass
35
36 def read(self):
37 pass
38
39 def disconnect(self):
40 pass
41