Mercurial > libervia-backend
comparison frontends/src/bridge/bridge_frontend.py @ 1062:95758ef3faa8
bridge: async failures are more detailed (full class name + error message)
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 07 Jun 2014 15:20:39 +0200 |
parents | 1fe00f0c9a91 |
children | f094583732de |
comparison
equal
deleted
inserted
replaced
1061:3700165d68dc | 1062:95758ef3faa8 |
---|---|
15 # GNU Affero General Public License for more details. | 15 # GNU Affero General Public License for more details. |
16 | 16 |
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 | |
20 class BridgeFrontend(object): | 21 class BridgeFrontend(object): |
21 def __init__(self): | 22 def __init__(self): |
22 print "Bridge frontend initialization" | 23 print "Bridge frontend initialization" |
23 | 24 |
24 | |
25 def register(self, functionName, handler): | 25 def register(self, functionName, handler): |
26 raise NotImplementedError | 26 raise NotImplementedError |
27 | |
28 | |
29 class BridgeException(Exception): | |
30 """An exception which has been raised from the backend and arrived to the frontend.""" | |
31 | |
32 def __init__(self, name, message): | |
33 """ | |
34 | |
35 @param name (str): full exception class name (with module) | |
36 @param message (str): error message | |
37 """ | |
38 Exception.__init__(self) | |
39 self.fullname = unicode(name) | |
40 self.message = unicode(message) | |
41 self.module, dummy, self.classname = unicode(self.fullname).rpartition('.') | |
42 | |
43 def __str__(self): | |
44 message = (': %s' % self.message) if self.message else '' | |
45 return self.classname + message | |
46 | |
47 def __eq__(self, other): | |
48 return self.classname == other |