Commit e32f7d29 authored by Peter Leitzen's avatar Peter Leitzen

Propagate storage errors

We will handle them in the worker and schedule a retry
parent 44e01684
......@@ -51,8 +51,6 @@ module StatusPage
storage_client.upload_object(key, content)
success(object_key: key)
rescue StatusPage::Storage::Error => e
error(e.message, error: e)
end
def limit_exceeded?(json)
......
......@@ -26,14 +26,10 @@ describe StatusPage::PublishIncidentService do
end
context 'when uploading details fails' do
it 'returns error and skip list upload' do
it 'propagates the exception' do
expect_to_upload_details(issue, status: 404)
expect(result).to be_error
path = StatusPage::Storage.details_path(issue.iid)
expect(result.message).to include('NotFound')
expect(result.message).to include(path)
expect { result }.to raise_error(StatusPage::Storage::Error)
end
end
......@@ -42,11 +38,7 @@ describe StatusPage::PublishIncidentService do
expect_to_upload_details(issue)
expect_to_upload_list(status: 404)
expect(result).to be_error
path = StatusPage::Storage.list_path
expect(result.message).to include('NotFound')
expect(result.message).to include(path)
expect { result }.to raise_error(StatusPage::Storage::Error)
end
end
......
......@@ -47,10 +47,8 @@ RSpec.shared_examples 'publish incidents' do
.and_raise(exception)
end
it 'returns an error with exception' do
expect(result).to be_error
expect(result.message).to eq(exception.message)
expect(result.payload).to eq(error: exception)
it 'propagates the exception' do
expect { result }.to raise_error(exception)
end
end
......
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