Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fluent namespace to ConfigError in v0.14 API based plugins #1223

Merged
merged 1 commit into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/fluent/plugin/filter_grep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ def configure(conf)
(1..REGEXP_MAX_NUM).each do |i|
next unless conf["regexp#{i}"]
key, regexp = conf["regexp#{i}"].split(/ /, 2)
raise ConfigError, "regexp#{i} does not contain 2 parameters" unless regexp
raise ConfigError, "regexp#{i} contains a duplicated key, #{key}" if @regexps[key]
raise Fluent::ConfigError, "regexp#{i} does not contain 2 parameters" unless regexp
raise Fluent::ConfigError, "regexp#{i} contains a duplicated key, #{key}" if @regexps[key]
@regexps[key] = Regexp.compile(regexp)
end

@excludes = {}
(1..REGEXP_MAX_NUM).each do |i|
next unless conf["exclude#{i}"]
key, exclude = conf["exclude#{i}"].split(/ /, 2)
raise ConfigError, "exclude#{i} does not contain 2 parameters" unless exclude
raise ConfigError, "exclude#{i} contains a duplicated key, #{key}" if @excludes[key]
raise Fluent::ConfigError, "exclude#{i} does not contain 2 parameters" unless exclude
raise Fluent::ConfigError, "exclude#{i} contains a duplicated key, #{key}" if @excludes[key]
@excludes[key] = Regexp.compile(exclude)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/plugin/in_syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def initialize
when 'udp'
:udp
else
raise ConfigError, "syslog input protocol type should be 'tcp' or 'udp'"
raise Fluent::ConfigError, "syslog input protocol type should be 'tcp' or 'udp'"
end
end
desc 'If true, add source host to event record.'
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/plugin/out_exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ExecOutput < Output
desc "The format used to map the incoming events to the program input. (#{Fluent::ExecUtil::SUPPORTED_FORMAT.keys.join(',')})"
config_param :format, default: :tsv, skip_accessor: true do |val|
f = Fluent::ExecUtil::SUPPORTED_FORMAT[val]
raise ConfigError, "Unsupported format '#{val}'" unless f
raise Fluent::ConfigError, "Unsupported format '#{val}'" unless f
f
end
config_param :localtime, :bool, default: false
Expand Down
4 changes: 2 additions & 2 deletions lib/fluent/plugin/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def configure(conf)
super

if @time_key && !@keys.include?(@time_key) && @estimate_current_event
raise ConfigError, "time_key (#{@time_key.inspect}) is not included in keys (#{@keys.inspect})"
raise Fluent::ConfigError, "time_key (#{@time_key.inspect}) is not included in keys (#{@keys.inspect})"
end

if @time_format && !@time_key
raise ConfigError, "time_format parameter is ignored because time_key parameter is not set. at #{conf.inspect}"
raise Fluent::ConfigError, "time_format parameter is ignored because time_key parameter is not set. at #{conf.inspect}"
end

@time_parser = time_parser_create
Expand Down
10 changes: 5 additions & 5 deletions lib/fluent/plugin/parser_multiline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def configure(conf)
@parser = Fluent::Plugin::RegexpParser.new
@parser.configure(conf + regexp_conf)
rescue => e
raise ConfigError, "Invalid regexp '#{formats}': #{e}"
raise Fluent::ConfigError, "Invalid regexp '#{formats}': #{e}"
end

if @format_firstline
Expand Down Expand Up @@ -68,7 +68,7 @@ def parse_formats(conf)
(1..FORMAT_MAX_NUM).map { |i|
format = conf["format#{i}"]
if (i > 1) && prev_format.nil? && !format.nil?
raise ConfigError, "Jump of format index found. format#{i - 1} is missing."
raise Fluent::ConfigError, "Jump of format index found. format#{i - 1} is missing."
end
prev_format = format
next if format.nil?
Expand All @@ -84,7 +84,7 @@ def check_format_range(conf)
m ? !((1..FORMAT_MAX_NUM).include?(m[1].to_i)) : false
}
unless invalid_formats.empty?
raise ConfigError, "Invalid formatN found. N should be 1 - #{FORMAT_MAX_NUM}: " + invalid_formats.join(",")
raise Fluent::ConfigError, "Invalid formatN found. N should be 1 - #{FORMAT_MAX_NUM}: " + invalid_formats.join(",")
end
end

Expand All @@ -93,10 +93,10 @@ def check_format_regexp(format, key)
begin
Regexp.new(format[1..-2], Regexp::MULTILINE)
rescue => e
raise ConfigError, "Invalid regexp in #{key}: #{e}"
raise Fluent::ConfigError, "Invalid regexp in #{key}: #{e}"
end
else
raise ConfigError, "format should be Regexp, need //, in #{key}: '#{format}'"
raise Fluent::ConfigError, "format should be Regexp, need //, in #{key}: '#{format}'"
end
end
end
Expand Down