bridge: async failures are more detailed (full class name + error message)

This commit is contained in:
souliane 2014-06-07 15:20:39 +02:00
commit b9106c65d6

View file

@ -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