lib/inspec/profile.rb in inspec-0.14.2 vs lib/inspec/profile.rb in inspec-0.14.3

- old
+ new

@@ -15,14 +15,19 @@ def self.for_target(target, opts) # Fetchers retrieve file contents opts[:target] = target fetcher = Inspec::Fetcher.resolve(target) - return nil if fetcher.nil? + if fetcher.nil? + fail("Could not fetch inspec profile in #{target.inspect}.") + end # Source readers understand the target's structure and provide # access to tests, libraries, and metadata reader = Inspec::SourceReader.resolve(fetcher.relative_target) - return nil if reader.nil? + if reader.nil? + fail("Don't understand inspec profile in #{target.inspect}, it "\ + "doesn't look like a supported profile structure.") + end new(reader, opts) end attr_reader :source_reader def_delegator :@source_reader, :tests