Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Raise helpful error
Browse files Browse the repository at this point in the history
Point user at installation instructions if data not found.
  • Loading branch information
joecorcoran committed Oct 29, 2013
1 parent e58296b commit 7201f8c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/cities/city.rb
Expand Up @@ -65,10 +65,16 @@ def has_data?
end

def path_for_country(code)
raise unless has_data?
raise DataNotFound.new unless has_data?
File.join(data_path, "#{code}.json")
end

end

class DataNotFound < StandardError
def message
'JSON data not found. See README.md for installation instructions.'
end
end

end

0 comments on commit 7201f8c

Please sign in to comment.