lib/grooveshark/errors.rb in grooveshark-0.2.1 vs lib/grooveshark/errors.rb in grooveshark-0.2.2
- old
+ new
@@ -1,5 +1,18 @@
module Grooveshark
class InvalidAuthentication < Exception ; end
class ReadOnlyAccess < Exception ; end
class GeneralError < Exception ; end
+
+ class ApiError < Exception
+ attr_reader :code
+
+ def initialize(fault)
+ @code = fault['code']
+ @message = fault['message']
+ end
+
+ def to_s
+ "#{@code} - #{@message}"
+ end
+ end
end
\ No newline at end of file