@@ -177,19 +177,18 @@ def register
177
177
# TODO(sissel): Validate conversion requests if provided.
178
178
@convert . nil? or @convert . each do |field , type |
179
179
if !valid_conversions . include? ( type )
180
- @logger . error ( "Invalid conversion type" ,
181
- "type" => type , "expected one of" => valid_types )
182
- # TODO(sissel): It's 2011, man, let's actually make like.. a proper
183
- # 'configuration broken' exception
184
- raise "Bad configuration, aborting."
180
+ raise LogStash ::ConfigurationError , I18n . t ( "logstash.agent.configuration.invalid_plugin_register" ,
181
+ :plugin => "filter" , :type => "mutate" ,
182
+ :error => "Invalid conversion type '#{ type } ', expected one of '#{ valid_conversions . join ( ',' ) } '" )
185
183
end
186
184
end # @convert.each
187
185
188
186
@gsub_parsed = [ ]
189
187
@gsub . nil? or @gsub . each_slice ( 3 ) do |field , needle , replacement |
190
188
if [ field , needle , replacement ] . any? { |n | n . nil? }
191
- @logger . error ( "Invalid gsub configuration. gsub has to define 3 elements per config entry" , :field => field , :needle => needle , :replacement => replacement )
192
- raise "Bad configuration, aborting."
189
+ raise LogStash ::ConfigurationError , I18n . t ( "logstash.agent.configuration.invalid_plugin_register" ,
190
+ :plugin => "filter" , :type => "mutate" ,
191
+ :error => "Invalid gsub configuration #{ [ field , needle , replacement ] } . gsub requires 3 non-nil elements per config entry" )
193
192
end
194
193
195
194
@gsub_parsed << {
0 commit comments