Commit 9f1361f5 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'hchouraria-github-importer-present-http-status-code-during-error' into 'master'

Expose HTTP code during GitHub importer errors

See merge request gitlab-org/gitlab!83818
parents d07b33b4 463c8c66
...@@ -117,7 +117,7 @@ module Import ...@@ -117,7 +117,7 @@ module Import
error: exception.response_body error: exception.response_body
) )
error(_('Import failed due to a GitHub error: %{original}') % { original: exception.response_body }, :unprocessable_entity) error(_('Import failed due to a GitHub error: %{original} (HTTP %{code})') % { original: exception.response_body, code: exception.response_status }, :unprocessable_entity)
end end
def log_and_return_error(message, translated_message, http_status) def log_and_return_error(message, translated_message, http_status)
......
...@@ -18864,7 +18864,7 @@ msgstr "" ...@@ -18864,7 +18864,7 @@ msgstr ""
msgid "Import and export rate limits" msgid "Import and export rate limits"
msgstr "" msgstr ""
msgid "Import failed due to a GitHub error: %{original}" msgid "Import failed due to a GitHub error: %{original} (HTTP %{code})"
msgstr "" msgstr ""
msgid "Import from" msgid "Import from"
......
...@@ -34,11 +34,11 @@ RSpec.describe Import::GithubService do ...@@ -34,11 +34,11 @@ RSpec.describe Import::GithubService do
subject.execute(access_params, :github) subject.execute(access_params, :github)
end end
it 'returns an error' do it 'returns an error with message and code' do
result = subject.execute(access_params, :github) result = subject.execute(access_params, :github)
expect(result).to include( expect(result).to include(
message: 'Import failed due to a GitHub error: Not Found', message: 'Import failed due to a GitHub error: Not Found (HTTP 404)',
status: :error, status: :error,
http_status: :unprocessable_entity http_status: :unprocessable_entity
) )
......
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