[BB Importer] Save the error trace and the whole raw document

This commit is contained in:
Valery Sizov 2017-03-01 10:25:35 +02:00
parent 3082a1195c
commit 3bc114a7c1
3 changed files with 9 additions and 6 deletions

View file

@ -0,0 +1,5 @@
---
title: "[BB Importer] Save the error trace and the whole raw document to debug problems
easier"
merge_request:
author:

View file

@ -1,6 +1,8 @@
module Bitbucket
module Representation
class Base
attr_reader :raw
def initialize(raw)
@raw = raw
end
@ -8,10 +10,6 @@ module Bitbucket
def self.decorate(entries)
entries.map { |entry| new(entry)}
end
private
attr_reader :raw
end
end
end

View file

@ -149,7 +149,7 @@ module Gitlab
description += @formatter.author_line(pull_request.author) unless find_user_id(pull_request.author)
description += pull_request.description
merge_request = project.merge_requests.create(
merge_request = project.merge_requests.create!(
iid: pull_request.iid,
title: pull_request.title,
description: description,
@ -168,7 +168,7 @@ module Gitlab
import_pull_request_comments(pull_request, merge_request) if merge_request.persisted?
rescue StandardError => e
errors << { type: :pull_request, iid: pull_request.iid, errors: e.message }
errors << { type: :pull_request, iid: pull_request.iid, errors: e.message, trace: e.backtrace.join("\n"), raw_response: pull_request.raw }
end
end
end