Skip to content

Commit

Permalink
Use raise instead of explicit emit_error_event for non reserve_data case
Browse files Browse the repository at this point in the history
  • Loading branch information
repeatedly committed Mar 15, 2017
1 parent 0790ae6 commit ac63f22
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/fluent/plugin/filter_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,22 @@ def filter_with_time(tag, time, record)
end
rescue Fluent::Plugin::Parser::ParserError => e
if @emit_invalid_record_to_error
router.emit_error_event(tag, time, record, e)
raise e
else
return FAILED_RESULT
end
return FAILED_RESULT
rescue ArgumentError => e
raise unless @replace_invalid_sequence
raise unless e.message.index("invalid byte sequence in") == 0

raw_value = raw_value.scrub(REPLACE_CHAR)
retry
rescue => e
if @emit_invalid_record_to_error
router.emit_error_event(tag, time, record, Fluent::Plugin::Parser::ParserError.new("parse failed #{e.message}"))
if @emit_invalid_record_to_error
raise Fluent::Plugin::Parser::ParserError, "parse failed #{e.message}"
else
return FAILED_RESULT
end
return FAILED_RESULT
end
end

Expand Down

0 comments on commit ac63f22

Please sign in to comment.