Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/topics/merge_service.rb')
-rw-r--r--app/services/topics/merge_service.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/services/topics/merge_service.rb b/app/services/topics/merge_service.rb
index 0d256579fe0..58f3d5305b4 100644
--- a/app/services/topics/merge_service.rb
+++ b/app/services/topics/merge_service.rb
@@ -17,14 +17,21 @@ module Topics
refresh_target_topic_counters
delete_source_topic
end
+
+ ServiceResponse.success
+ rescue ArgumentError => e
+ ServiceResponse.error(message: e.message)
+ rescue StandardError => e
+ Gitlab::ErrorTracking.track_exception(e, source_topic_id: source_topic.id, target_topic_id: target_topic.id)
+ ServiceResponse.error(message: _('Topics could not be merged!'))
end
private
def validate_parameters!
- raise ArgumentError, 'The source topic is not a topic.' unless source_topic.is_a?(Projects::Topic)
- raise ArgumentError, 'The target topic is not a topic.' unless target_topic.is_a?(Projects::Topic)
- raise ArgumentError, 'The source topic and the target topic are identical.' if source_topic == target_topic
+ raise ArgumentError, _('The source topic is not a topic.') unless source_topic.is_a?(Projects::Topic)
+ raise ArgumentError, _('The target topic is not a topic.') unless target_topic.is_a?(Projects::Topic)
+ raise ArgumentError, _('The source topic and the target topic are identical.') if source_topic == target_topic
end
# rubocop: disable CodeReuse/ActiveRecord