diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /app/models/bulk_imports | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'app/models/bulk_imports')
-rw-r--r-- | app/models/bulk_imports/entity.rb | 2 | ||||
-rw-r--r-- | app/models/bulk_imports/export_status.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/models/bulk_imports/entity.rb b/app/models/bulk_imports/entity.rb index 38b7da76306..a7e1384641c 100644 --- a/app/models/bulk_imports/entity.rb +++ b/app/models/bulk_imports/entity.rb @@ -20,6 +20,8 @@ class BulkImports::Entity < ApplicationRecord self.table_name = 'bulk_import_entities' + FailedError = Class.new(StandardError) + belongs_to :bulk_import, optional: false belongs_to :parent, class_name: 'BulkImports::Entity', optional: true diff --git a/app/models/bulk_imports/export_status.rb b/app/models/bulk_imports/export_status.rb index abf064adaae..cae6aad27da 100644 --- a/app/models/bulk_imports/export_status.rb +++ b/app/models/bulk_imports/export_status.rb @@ -30,7 +30,12 @@ module BulkImports def export_status strong_memoize(:export_status) do - fetch_export_status.find { |item| item['relation'] == relation } + status = fetch_export_status + + # Consider empty response as failed export + raise StandardError, 'Empty export status response' unless status&.present? + + status.find { |item| item['relation'] == relation } end rescue StandardError => e { 'status' => Export::FAILED, 'error' => e.message } |