diff --git a/bin/normalize.rb b/bin/normalize.rb index bf9593f..4629796 100755 --- a/bin/normalize.rb +++ b/bin/normalize.rb @@ -78,6 +78,10 @@ sources.each do |s| begin s.normalize + rescue ::InetData::Source::Base::NotImplemented + # logger.log("Warning: Source #{s.name} does not implement normalize()") + rescue ::Interrupt + logger.log("Error: Source #{s.name} was interrupted: #{$!.class} #{$!} #{$!.backtrace}") rescue ::Exception logger.log("Error: Source #{s.name} threw an exception: #{$!.class} #{$!} #{$!.backtrace}") end diff --git a/lib/inetdata/source/base.rb b/lib/inetdata/source/base.rb index 69c568f..89e9bb5 100644 --- a/lib/inetdata/source/base.rb +++ b/lib/inetdata/source/base.rb @@ -2,6 +2,9 @@ module InetData module Source class Base + class NotImplemented < ::RuntimeError + end + @@have_inetdata_parsers = nil VALID_HOSTNAME = /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$/ @@ -57,11 +60,11 @@ def reports_path end def download - raise RuntimeError.new, "Download not implemented for source #{self.name}" + raise NotImplemented end def normalize - raise RuntimeError.new, "Normalize not implemented for source #{self.name}" + raise NotImplemented end def validate_domain(dname)