Skip to content
Browse files

begin rescue block if business isnt found.

  • Loading branch information...
1 parent 758d10f commit f4e0f2b89c232f8e41bd7629df54fa16dec19302 @brntbeer committed
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/yelpme.rb
View
12 lib/yelpme.rb
@@ -76,7 +76,8 @@ def self.nearby(lat, long)
# Returns output!
def self.output(business, options)
- text = unless options[:full_output]
+ begin
+ text = unless options[:full_output]
%{
Name: #{business.name}
Rating: #{business.rating}
@@ -86,9 +87,12 @@ def self.output(business, options)
Phone: \e[33m#{business.phone rescue "No Number Posted"}\e[0m
}.gsub(/^ {8}/, '')
- else
- business
- end
+ else
+ business
+ end
+ rescue
+ text = "No business found.\nPlease ensure your business or search terms are typed correctly."
+ end
options[:full_output] ? (pp text) : (puts text)
end

0 comments on commit f4e0f2b

Please sign in to comment.
Something went wrong with that request. Please try again.