w = worker.DataWorker(None, None, None, self.src, None, daemon_id=1)
w.wait_for_object = lambda *a: None
- with py.test.raises(client.HttpError) as exc:
+ with py.test.raises(worker.SyncFailed) as exc:
w.sync_object('mah-bucket', 'mah-object')
exc_message = exc.exconly()
- assert 'error code 500 content Internal Server Error' in exc_message
+ assert 'HTTP error with status: 500' in exc_message
def test_fails_to_remove_op_state(self, capsys):
# really tricky to test this one, we are forced to just use `capsys` from py.test
except client.HttpError as e:
# if we have a non-critical Http error, raise a SyncFailed
# so that we can retry this. The Gateway may be returning 400's
- if e.str_code[0] in ['3', '4']:
- msg = 'encountered an HTTP error with status: %s' % e.str_code
- raise SyncFailed(msg)
- else:
- # if the error is critical, as in anything that is a 500
- # raise
- log.exception('got a critical http error from client')
- raise
-
+ msg = 'encountered an HTTP error with status: %s' % e.str_code
+ raise SyncFailed(msg)
except SyncFailed:
raise
except Exception as e: