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