Skip to content

Commit

Permalink
Merge pull request #358 from roo-rb/raise_error_if_path_missing_from_…
Browse files Browse the repository at this point in the history
…extractor

Raise an error Roo::Excelx::Extractor document is missing
  • Loading branch information
stevendaniels committed Dec 28, 2016
2 parents cb97486 + 27c81ed commit b50c370
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/roo/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ class Error < StandardError; end
# Raised when Roo cannot find a header row that matches the given column
# name(s).
class HeaderRowNotFoundError < Error; end

class FileNotFound < Error; end
end
6 changes: 3 additions & 3 deletions lib/roo/excelx/extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def initialize(path)
private

def doc
if doc_exists?
::Roo::Utils.load_xml(@path).remove_namespaces!
end
raise FileNotFound, "#{@path} file not found" unless doc_exists?

::Roo::Utils.load_xml(@path).remove_namespaces!
end

def doc_exists?
Expand Down

0 comments on commit b50c370

Please sign in to comment.