Commit 426ba922 authored by Jeremy Hylton's avatar Jeremy Hylton

Simplify error logging code.

Don't catch a specific set of errors, catch anything, log the message
that failed, and re-raise the exception.

Eliminate unused class variable VERSION and unused import of struct.
parent 4a34bfaf
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
############################################################################## ##############################################################################
import cPickle import cPickle
from cStringIO import StringIO from cStringIO import StringIO
import struct
import types import types
import zLOG import zLOG
...@@ -31,13 +30,6 @@ class Marshaller: ...@@ -31,13 +30,6 @@ class Marshaller:
pickler.fast = 1 pickler.fast = 1
pickle = pickler.dump pickle = pickler.dump
errors = (cPickle.UnpickleableError,
cPickle.UnpicklingError,
cPickle.PickleError,
cPickle.PicklingError)
VERSION = 1
def encode(self, msgid, flags, name, args): def encode(self, msgid, flags, name, args):
"""Returns an encoded message""" """Returns an encoded message"""
return self.pickle((msgid, flags, name, args), 1) return self.pickle((msgid, flags, name, args), 1)
...@@ -49,7 +41,7 @@ class Marshaller: ...@@ -49,7 +41,7 @@ class Marshaller:
try: try:
return unpickler.load() # msgid, flags, name, args return unpickler.load() # msgid, flags, name, args
except (self.errors, IndexError), err_msg: except:
log("can't decode message: %s" % repr(msg), level=zLOG.ERROR) log("can't decode message: %s" % repr(msg), level=zLOG.ERROR)
raise raise
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment