Mercurial > libervia-backend
diff 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 |
line wrap: on
line diff
--- a/frontends/src/bridge/bridge_frontend.py Mon Jun 02 19:25:06 2014 +0200 +++ b/frontends/src/bridge/bridge_frontend.py Sat Jun 07 15:20:39 2014 +0200 @@ -17,10 +17,32 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. + class BridgeFrontend(object): def __init__(self): print "Bridge frontend initialization" - def register(self, functionName, handler): raise NotImplementedError + + +class BridgeException(Exception): + """An exception which has been raised from the backend and arrived to the frontend.""" + + def __init__(self, name, message): + """ + + @param name (str): full exception class name (with module) + @param message (str): error message + """ + Exception.__init__(self) + self.fullname = unicode(name) + self.message = unicode(message) + self.module, dummy, self.classname = unicode(self.fullname).rpartition('.') + + def __str__(self): + message = (': %s' % self.message) if self.message else '' + return self.classname + message + + def __eq__(self, other): + return self.classname == other