Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 44ea619d08
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (29 sloc) 1.152 kb
class FailureError(Exception): pass
class JobError(FailureError): pass
class BeanStalkError(Exception): pass
class ProtoError(BeanStalkError): pass
class ServerError(BeanStalkError): pass
class NotConnected(BeanStalkError): pass
class OutOfMemory(ServerError): pass
class InternalError(ServerError): pass
class Draining(ServerError): pass
class BadFormat(ProtoError): pass
class UnknownCommand(ProtoError): pass
class ExpectedCrlf(ProtoError): pass
class JobTooBig(ProtoError): pass
class NotFound(ProtoError): pass
class NotIgnored(ProtoError): pass
class DeadlineSoon(ProtoError):pass
class UnexpectedResponse(ProtoError): pass
def checkError(linestr):
'''Note, this will throw an error internally for every case that is a
response that is NOT an error response, and that error will be caught,
and checkError will return happily.
In the case that an error was returned by beanstalkd, an appropriate error
will be raised'''
errname = ''.join([x.capitalize() for x in linestr.split('_')])
err = eval(errname)('Server returned: %s' % (linestr,))
except Exception, e:
raise err
Jump to Line
Something went wrong with that request. Please try again.