Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Commit

Permalink
Don't spam errors for missing normalize, fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
hdm committed Sep 28, 2018
1 parent 3d64533 commit e06ceb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions bin/normalize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions lib/inetdata/source/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]))*$/
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e06ceb5

Please sign in to comment.