]> git.r.bdr.sh - rbdr/lyricli.rb/commitdiff
Change error names to favor convention
authorBen Beltran <redacted>
Sat, 6 Oct 2012 08:02:43 +0000 (03:02 -0500)
committerBen Beltran <redacted>
Sat, 6 Oct 2012 08:02:43 +0000 (03:02 -0500)
18 files changed:
lib/lyricli.rb
lib/lyricli/.DS_Store [new file with mode: 0644]
lib/lyricli/exceptions/disable_source_error.rb [moved from lib/lyricli/exceptions/lyrics_not_found_exception.rb with 54% similarity]
lib/lyricli/exceptions/enable_source_error.rb [moved from lib/lyricli/exceptions/invalid_lyrics_exception.rb with 55% similarity]
lib/lyricli/exceptions/invalid_lyrics_error.rb [new file with mode: 0644]
lib/lyricli/exceptions/lyrics_not_found_error.rb [new file with mode: 0644]
lib/lyricli/exceptions/reset_source_error.rb [moved from lib/lyricli/exceptions/disable_source_exception.rb with 55% similarity]
lib/lyricli/exceptions/reset_source_exception.rb [deleted file]
lib/lyricli/exceptions/source_configuration_error.rb [new file with mode: 0644]
lib/lyricli/exceptions/source_configuration_exception.rb [deleted file]
lib/lyricli/exceptions/start_source_error.rb [moved from lib/lyricli/exceptions/enable_source_exception.rb with 55% similarity]
lib/lyricli/exceptions/start_source_exception.rb [deleted file]
lib/lyricli/exceptions/unknown_source_error.rb [new file with mode: 0644]
lib/lyricli/exceptions/unknown_source_exception.rb [deleted file]
lib/lyricli/lyricli.rb
lib/lyricli/lyrics_engine.rb
lib/lyricli/source_manager.rb
lyricli-0.0.1.gem

index 1c908b0f1bce666553e266f3b89e9fa4e404685f..041959b505a486eb5f0d196a08ee51cdf4217fbc 100755 (executable)
@@ -17,9 +17,19 @@ require "lyricli/configuration"
 require "lyricli/lyricli"
 require "lyricli/lyrics_engine"
 require "lyricli/source_manager"
+require "lyricli/sources"
 require "lyricli/sources/arguments"
 require "lyricli/sources/rdio"
 require "lyricli/sources/itunes"
+require "lyricli/exceptions"
+require "lyricli/exceptions/disable_source_error"
+require "lyricli/exceptions/enable_source_error"
+require "lyricli/exceptions/invalid_lyrics_error"
+require "lyricli/exceptions/lyrics_not_found_error"
+require "lyricli/exceptions/reset_source_error"
+require "lyricli/exceptions/source_configuration_error"
+require "lyricli/exceptions/start_source_error"
+require "lyricli/exceptions/unknown_source_error"
 
 # The Lyricli module allows you to easily search for lyrics by looking for
 # song and artist data from diverse sources.
diff --git a/lib/lyricli/.DS_Store b/lib/lyricli/.DS_Store
new file mode 100644 (file)
index 0000000..bf6d0c0
Binary files /dev/null and b/lib/lyricli/.DS_Store differ
similarity index 54%
rename from lib/lyricli/exceptions/lyrics_not_found_exception.rb
rename to lib/lyricli/exceptions/disable_source_error.rb
index c09321dfe58861584bd7149a3e13a4e4a89c2b0a..1f9b0d3ad140e89805e4f6fd2165fca64e6b0fab 100644 (file)
@@ -1,6 +1,6 @@
 module Lyricli
   module Exceptions
-    class LyricsNotFoundException
+    class DisableSourceError < StandardError
     end
   end
 end
similarity index 55%
rename from lib/lyricli/exceptions/invalid_lyrics_exception.rb
rename to lib/lyricli/exceptions/enable_source_error.rb
index 30cab41d62aef3c58f74117e8939d07b340093ef..b1596c8415c312621055432a2de53b8fe86772e3 100644 (file)
@@ -1,6 +1,6 @@
 module Lyricli
   module Exceptions
-    class InvalidLyricsException
+    class EnableSourceError < StandardError
     end
   end
 end
diff --git a/lib/lyricli/exceptions/invalid_lyrics_error.rb b/lib/lyricli/exceptions/invalid_lyrics_error.rb
new file mode 100644 (file)
index 0000000..3f1b7c8
--- /dev/null
@@ -0,0 +1,7 @@
+module Lyricli
+  module Exceptions
+    class InvalidLyricsError < StandardError
+    end
+  end
+end
+
diff --git a/lib/lyricli/exceptions/lyrics_not_found_error.rb b/lib/lyricli/exceptions/lyrics_not_found_error.rb
new file mode 100644 (file)
index 0000000..023e3db
--- /dev/null
@@ -0,0 +1,7 @@
+module Lyricli
+  module Exceptions
+    class LyricsNotFoundError < StandardError
+    end
+  end
+end
+
similarity index 55%
rename from lib/lyricli/exceptions/disable_source_exception.rb
rename to lib/lyricli/exceptions/reset_source_error.rb
index 449c97980e8fac84b450beb5f4cfb94ad609cec4..0bfa7f4644392aa3b14112bf0267892d142cbc61 100644 (file)
@@ -1,6 +1,6 @@
 module Lyricli
   module Exceptions
-    class DisableSourceException
+    class ResetSourceError < StandardError
     end
   end
 end
diff --git a/lib/lyricli/exceptions/reset_source_exception.rb b/lib/lyricli/exceptions/reset_source_exception.rb
deleted file mode 100644 (file)
index ba079e4..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-module Lyricli
-  module Exceptions
-    class ResetSourceException
-    end
-  end
-end
-
diff --git a/lib/lyricli/exceptions/source_configuration_error.rb b/lib/lyricli/exceptions/source_configuration_error.rb
new file mode 100644 (file)
index 0000000..b297083
--- /dev/null
@@ -0,0 +1,7 @@
+module Lyricli
+  module Exceptions
+    class SourceConfigurationError < StandardError
+    end
+  end
+end
+
diff --git a/lib/lyricli/exceptions/source_configuration_exception.rb b/lib/lyricli/exceptions/source_configuration_exception.rb
deleted file mode 100644 (file)
index 9e9ef31..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-module Lyricli
-  module Exceptions
-    class SourceConfigurationException
-    end
-  end
-end
-
similarity index 55%
rename from lib/lyricli/exceptions/enable_source_exception.rb
rename to lib/lyricli/exceptions/start_source_error.rb
index f1395df30bd3b6bd2c5d2c8eb56000316e1c62fe..9db1549ee58b534cb72e66617e5c1d242cc5bcb7 100644 (file)
@@ -1,7 +1,6 @@
 module Lyricli
   module Exceptions
-    class EnableSourceException
+    class StartSourceError < StandardError
     end
   end
 end
-
diff --git a/lib/lyricli/exceptions/start_source_exception.rb b/lib/lyricli/exceptions/start_source_exception.rb
deleted file mode 100644 (file)
index 1abcc5a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-module Lyricli
-  module Exceptions
-    class StartSourceException
-    end
-  end
-end
diff --git a/lib/lyricli/exceptions/unknown_source_error.rb b/lib/lyricli/exceptions/unknown_source_error.rb
new file mode 100644 (file)
index 0000000..8d9ba62
--- /dev/null
@@ -0,0 +1,7 @@
+module Lyricli
+  module Exceptions
+    class UnknownSourceError < StandardError
+    end
+  end
+end
+
diff --git a/lib/lyricli/exceptions/unknown_source_exception.rb b/lib/lyricli/exceptions/unknown_source_exception.rb
deleted file mode 100644 (file)
index 3b16bea..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-module Lyricli
-  module Exceptions
-    class UnknownSourceException
-    end
-  end
-end
-
index 518db2df8d380f7671d58c8986c931eb6b8afa1c..d546e54d88187c717b01df6cb634213d3febe6ec 100644 (file)
@@ -9,12 +9,12 @@ module Lyricli
       @source_manager = SourceManager.new
     end
 
-    # 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
     #
-    # @raise [Lyricli::InvalidLyricsException] because we found nothing
+    # @raise [Lyricli::Exceptions::InvalidLyricsError] because we found nothing
     def exit_with_error
-      raise InvalidLyricsException
+      raise Exceptions::InvalidLyricsError
     end
 
     # Extracts the current track, validates it and requests the lyrics from our
@@ -29,7 +29,7 @@ module Lyricli
 
       begin
         engine.get_lyrics
-      rescue LyricsNotFoundException
+      rescue Exceptions::LyricsNotFoundError
         "Lyrics not found :("
       end
     end
index beacd4610490d6c17af4dc94f9c035dff08fe027..72ee4022a917685d44912f659d7f446436ddbeb7 100644 (file)
@@ -24,7 +24,7 @@ module Lyricli
         doc = Nokogiri::HTML(open(response['url']))
         node = doc.search(".lyricbox").first
       rescue
-        raise Lyricli::LyricsNotFoundException
+        raise Exceptions::LyricsNotFoundError
       end
 
       node.search(".rtMatcher").each do |n|
index 020870d6c78cfd0bd804c180cb0163f1ff133960..e6004dff034b922c389f289d4471dd00c18934f8 100644 (file)
@@ -15,7 +15,7 @@ module Lyricli
           current_source = klass.new
           @enabled_sources << current_source
         else
-          raise StartSourceException
+          raise Exceptions::StartSourceError
         end
       end
     end
@@ -33,10 +33,10 @@ module Lyricli
           @config["enabled_sources"].uniq!
           @config.save_config
         else
-          raise EnableSourceException
+          raise Exceptions::EnableSourceError
         end
       else
-        raise UnknownSourceException
+        raise Exceptions::UnknownSourceError
       end
     end
 
@@ -50,10 +50,10 @@ module Lyricli
           @config["enabled_sources"].delete(klass.name)
           @config.save_config
         else
-          raise DisableSourceException
+          raise Exceptions::DisableSourceError
         end
       else
-        raise UnknownSourceException
+        raise Exceptions::UnknownSourceError
       end
     end
 
@@ -67,10 +67,10 @@ module Lyricli
           klass.reset
           disable(source_name)
         else
-          raise ResetSourceException
+          raise Exceptions::ResetSourceError
         end
       else
-        raise UnknownSourceException
+        raise Exceptions::UnknownSourceError
       end
     end
 
@@ -92,7 +92,7 @@ module Lyricli
             lock = true if source.class.name == "arguments"
           end
         rescue
-          raise SourceConfigurationException
+          raise Exceptions::SourceConfigurationError
         end
       end
       track
index bb1d4de068b8a585c43e6ba9b0e758131911544e..c5bbe76f86a5b82aed30fd7ec80fc9fe6d79a19f 100644 (file)
Binary files a/lyricli-0.0.1.gem and b/lyricli-0.0.1.gem differ