Exemplo n.º 1
0
 def runTransaction(trans):
     try:
         trans.awake()
         trans.respond()
     except Exception, first:
         try:
             trans.sleep()
         except Exception, second:
             # The first exception is more important than the *second* one
             # that comes from sleep(). In fact, without this little trick
             # the first exception gets hidden by the second which is often
             # just a result of the first. Then you're stuck scratching your
             # head wondering what the first might have been.
             raise Exception('Two exceptions. first=%s; second=%s'
                 % (excstr(first), excstr(second)))
Exemplo n.º 2
0
 def runTransaction(trans):
     try:
         trans.awake()
         trans.respond()
     except Exception as first:
         try:
             trans.sleep()
         except Exception as second:
             # The first exception is more important than the *second* one
             # that comes from sleep(). In fact, without this little trick
             # the first exception gets hidden by the second which is often
             # just a result of the first. Then you're stuck scratching your
             # head wondering what the first might have been.
             raise Exception('Two exceptions. first=%s; second=%s'
                 % (excstr(first), excstr(second)))
         else:
             raise  # no problems with sleep() so raise the one and only exception
     else:
         trans.sleep()
Exemplo n.º 3
0
	def debugStr(self):
		out = [self.__class__.__name__, '(', '0x%x'%id(self)]
		sep = ', '
		for key in self._debugKeys:
			out.append(sep)
			out.append(key)
			out.append('=')
			try:
				out.append(repr(self.valueForName(key)))
			except Exception, exc:
				from MiscUtils.Funcs import excstr
				out.append('('+excstr(exc)+')')
Exemplo n.º 4
0
 def debugStr(self):
     out = [self.__class__.__name__, '(', '0x%x' % id(self)]
     sep = ', '
     for key in self._debugKeys:
         out.append(sep)
         out.append(key)
         out.append('=')
         try:
             out.append(repr(valueForName(self, key)))
         except Exception as exc:
             from MiscUtils.Funcs import excstr
             out.append('(' + excstr(exc) + ')')
     out.append(')')
     out = ''.join(out)
     return out
Exemplo n.º 5
0
 def testExcstr(self):
     self.assertEqual(excstr(None), None)
     self.assertEqual(excstr(ValueError('Kawoom!')), 'ValueError: Kawoom!')