Skip to content

Commit

Permalink
Merge pull request #7 from marktabler/master
Browse files Browse the repository at this point in the history
Clearer error message if weather data is not found
  • Loading branch information
greatuserongithub committed Jun 14, 2013
2 parents da27ce8 + b181ce5 commit 293b970
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/google_weather/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 293b970

Please sign in to comment.