Permalink
Browse files

Merge pull request #7 from marktabler/master

Clearer error message if weather data is not found
  • Loading branch information...
2 parents da27ce8 + b181ce5 commit 293b970b56128d67eeda4ec53680154375416551 @jnunemaker committed Jun 14, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/google_weather/data.rb
View
8 lib/google_weather/data.rb
@@ -12,8 +12,12 @@ def method_missing(method)
end
def inspect
- data = @data.inject([]) { |collection, key| collection << "#{key[0]}: #{key[1]['data']}"; collection }.join("\n ")
- "#<#{self.class}:0x#{object_id}\n #{data}>"
+ begin
+ data = @data.inject([]) { |collection, key| collection << "#{key[0]}: #{key[1]['data']}"; collection }.join("\n ")
+ "#<#{self.class}:0x#{object_id}\n #{data}>"
+ rescue
+ "No weather information found for the specified location."
+ end
end
end

0 comments on commit 293b970

Please sign in to comment.