summaryrefslogtreecommitdiff
path: root/lib/gitlab/conflict
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-07-29 14:51:11 +0100
committerFatih Acet <acetfatih@gmail.com>2016-08-12 23:24:44 +0300
commitf2f844693ecd8a10d48530adf8d59a7c125d2752 (patch)
treebf5485f8c98722d92d381a4e6eedc03757cd197e /lib/gitlab/conflict
parent97ceadeea7b3ad9fa69049932149157334beba11 (diff)
downloadgitlab-ce-f2f844693ecd8a10d48530adf8d59a7c125d2752.tar.gz
Handle conflict resolution errors in controller
Diffstat (limited to 'lib/gitlab/conflict')
-rw-r--r--lib/gitlab/conflict/file.rb10
-rw-r--r--lib/gitlab/conflict/parser.rb7
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/gitlab/conflict/file.rb b/lib/gitlab/conflict/file.rb
index 9ba8ae0367f..598bf2a2612 100644
--- a/lib/gitlab/conflict/file.rb
+++ b/lib/gitlab/conflict/file.rb
@@ -35,23 +35,23 @@ module Gitlab
end
def resolve_lines(resolution)
- current_section = nil
+ section_id = nil
lines.map do |line|
unless line.type
- current_section = nil
+ section_id = nil
next line
end
- current_section ||= resolution[line_code(line)]
+ section_id ||= line_code(line)
- case current_section
+ case resolution[section_id]
when 'ours'
next unless line.type == 'new'
when 'theirs'
next unless line.type == 'old'
else
- raise MissingResolution
+ raise MissingResolution, "Missing resolution for section ID: #{section_id}"
end
line
diff --git a/lib/gitlab/conflict/parser.rb b/lib/gitlab/conflict/parser.rb
index 0aa85202d56..8ab7b6499aa 100644
--- a/lib/gitlab/conflict/parser.rb
+++ b/lib/gitlab/conflict/parser.rb
@@ -1,10 +1,13 @@
module Gitlab
module Conflict
class Parser
- class UnexpectedDelimiter < StandardError
+ class ParserError < StandardError
end
- class MissingEndDelimiter < StandardError
+ class UnexpectedDelimiter < ParserError
+ end
+
+ class MissingEndDelimiter < ParserError
end
def parse(text, our_path:, their_path:, parent: nil)