By this point I'm really tired, I hope something silly didn't
go through.
#
# @return [String] the found lyrics, or a string indicating none were found
def get_lyrics
#
# @return [String] the found lyrics, or a string indicating none were found
def get_lyrics
- set_current_track
- check_params
+
+ begin
+ set_current_track
+ check_params
+ rescue Exceptions::InvalidLyricsError
+ return "No Artist/Song could be found :("
+ end
engine = LyricsEngine.new(@current_track[:artist], @current_track[:song])
begin
engine = LyricsEngine.new(@current_track[:artist], @current_track[:song])
begin
+ return engine.get_lyrics
rescue Exceptions::LyricsNotFoundError
rescue Exceptions::LyricsNotFoundError
+ return "Lyrics not found :("
# Exits with error when there is an empty field from the current track.
def check_params
# Exits with error when there is an empty field from the current track.
def check_params
+ self.exit_with_error unless @current_track
self.exit_with_error if @current_track[:artist].nil? or @current_track[:artist].empty?
self.exit_with_error if @current_track[:song].nil? or @current_track[:song].empty?
end
self.exit_with_error if @current_track[:artist].nil? or @current_track[:artist].empty?
self.exit_with_error if @current_track[:song].nil? or @current_track[:song].empty?
end