mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-09-20 07:21:22 +00:00
Added error handling
This commit is contained in:
parent
0626c8619f
commit
ad664d9f93
@ -16,8 +16,11 @@ module BytesRegex
|
|||||||
out erroroffset,
|
out erroroffset,
|
||||||
nil)
|
nil)
|
||||||
else
|
else
|
||||||
# FIXME: show actual error message
|
msg = String.new(256) do |buffer|
|
||||||
raise Exception.new "Error compiling regex"
|
bytesize = LibPCRE2.get_error_message(errorcode, buffer, 256)
|
||||||
|
{bytesize, 0}
|
||||||
|
end
|
||||||
|
raise Exception.new "Error #{msg} compiling regex at offset #{erroroffset}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -37,7 +40,7 @@ module BytesRegex
|
|||||||
match_data,
|
match_data,
|
||||||
nil)
|
nil)
|
||||||
if rc < 0
|
if rc < 0
|
||||||
# FIXME: handle actual errors
|
# No match, do nothing
|
||||||
else
|
else
|
||||||
ovector = LibPCRE2.get_ovector_pointer(match_data)
|
ovector = LibPCRE2.get_ovector_pointer(match_data)
|
||||||
(0...rc).each do |i|
|
(0...rc).each do |i|
|
||||||
|
Loading…
Reference in New Issue
Block a user