Skip to content

Commit f0e8035

Browse files
Merge pull request #1986 from gooddata/STL-744
STL-744: Add error relate to synchronize translation to execution log
2 parents dc0cf98 + 80c4e59 commit f0e8035

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.68
1+
3.7.69

lib/gooddata/lcm/actions/synchronize_clients.rb

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,27 @@ def error_handle(segment, error_result, continue_on_error, params)
170170

171171
# Synchronize failure for all clients in segment
172172
if continue_on_error && success_count.zero? && failed_count.positive?
173-
segment_warning_message = "Failed to synchronize clients for #{segment.segment_id} segment. Details: #{sync_result['links']['details']}"
173+
segment_warning_message = "Failed to synchronize all clients for #{segment.segment_id} segment. Details: #{sync_result['links']['details']}"
174+
if sync_result['links'] && sync_result['links']['details'] # rubocop:disable Style/SafeNavigation
175+
begin
176+
client = params.gdc_gd_client
177+
response = client.get sync_result['links']['details']
178+
error_detail_result = response['synchronizationResultDetails']
179+
180+
if error_detail_result && error_detail_result['items'] # rubocop:disable Style/SafeNavigation
181+
error_count = 1
182+
error_detail_result['items'].each do |item|
183+
break if error_count > 5
184+
185+
GoodData.logger.warn(error_message(item, segment))
186+
error_count += 1
187+
end
188+
end
189+
rescue StandardError => ex
190+
GoodData.logger.warn "Failed to fetch result of synchronize clients. Error: #{ex.message}"
191+
end
192+
end
193+
174194
add_failed_segment(segment.segment_id, segment_warning_message, short_name, params)
175195
return
176196
end
@@ -192,7 +212,7 @@ def error_handle(segment, error_result, continue_on_error, params)
192212

193213
def error_message(error_item, segment)
194214
error_client_id = error_item['id']
195-
error_message = "Failed to synchronize #{error_client_id} client in #{segment.segment_id} segment."
215+
error_message = "Failed to synchronize #{error_client_id} client in #{segment.segment_id} segment"
196216
error_message = "#{error_message}. Detail: #{error_item['error']['message']}" if error_item['error'] && error_item['error']['message']
197217

198218
error_message = "#{error_message}. Error items: #{error_item['error']['parameters']}" if error_item['error'] && error_item['error']['parameters']

0 commit comments

Comments
 (0)