diff --git a/rq/job.py b/rq/job.py index 4d625bf..a0367ee 100644 --- a/rq/job.py +++ b/rq/job.py @@ -256,7 +256,7 @@ class Job(object): """ key = self.key obj = self.connection.hgetall(key) - if not obj: + if len(obj) == 0: raise NoSuchJobError('No such job: %s' % (key,)) def to_date(date_str): @@ -265,7 +265,11 @@ class Job(object): else: return times.to_universal(date_str) - self.data = obj.get('data') + try: + self.data = obj['data'] + except KeyError: + raise NoSuchJobError('Unexpected job format: {0}'.format(obj)) + try: self._func_name, self._instance, self._args, self._kwargs = unpickle(self.data) except UnpickleError: