X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/blobdiff_plain/f2ec7254120c90c3b023687f67a7b19f78b69370..a1f64790dc2a69580dc73022686e6806b6bf7349:/doc/Lyricli/Lyricli.html diff --git a/doc/Lyricli/Lyricli.html b/doc/Lyricli/Lyricli.html index 60c3a94..e3accb5 100644 --- a/doc/Lyricli/Lyricli.html +++ b/doc/Lyricli/Lyricli.html @@ -170,7 +170,7 @@ Exits with error when there is an empty field from the current track.

-Raises an InvalidLyricsException which means we did not get any valid +Raises an InvalidLyricsError which means we did not get any valid artist/song from any of the sources.

@@ -339,15 +339,17 @@ Exits with error when there is an empty field from the current track.
 
 
-44
-45
-46
-47
+49 +50 +51 +52 +53 -
# File 'lib/lyricli/lyricli.rb', line 44
+      
# File 'lib/lyricli/lyricli.rb', line 49
 
 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
@@ -368,7 +370,7 @@ Exits with error when there is an empty field from the current track.

-Raises an InvalidLyricsException which means we did not get any valid +Raises an InvalidLyricsError which means we did not get any valid artist/song from any of the sources

@@ -383,7 +385,7 @@ artist/song from any of the sources
  • - (Lyricli::InvalidLyricsException) + (Lyricli::Exceptions::InvalidLyricsError) @@ -411,7 +413,7 @@ because we found nothing
    # File 'lib/lyricli/lyricli.rb', line 16
     
     def exit_with_error
    -  raise InvalidLyricsException
    +  raise Exceptions::InvalidLyricsError
     end
    @@ -476,21 +478,31 @@ the found lyrics, or a string indicating none were found 32 33 34 -35
  • +35 +36 +37 +38 +39 +40
    # File 'lib/lyricli/lyricli.rb', line 24
     
     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.get_lyrics
    -  rescue LyricsNotFoundException
    -    "Lyrics not found :("
    +    return engine.get_lyrics
    +  rescue Exceptions::LyricsNotFoundError
    +    return "Lyrics not found :("
       end
     end
    @@ -526,12 +538,12 @@ its current track
     
     
    -39
    -40
    -41
    +44 +45 +46 -
    # File 'lib/lyricli/lyricli.rb', line 39
    +      
    # File 'lib/lyricli/lyricli.rb', line 44
     
     def set_current_track
       @current_track = @source_manager.current_track
    @@ -546,7 +558,7 @@ its current track