lib/ezid/responses/response.rb in ezid-client-1.3.0 vs lib/ezid/responses/response.rb in ezid-client-1.4.0

- old
+ new

@@ -57,16 +57,27 @@ end # Returns an exception instance if there was an error # @return [Ezid::Error] the exception def exception - @exception ||= (error? && Error.new(message)) + error_class.new(message) if error? end # The URI path of the request # @return [String] the path def uri_path __getobj__.uri.path + end + + def error_class + case message + when /no such identifier/ + IdentifierNotFoundError + when /identifier status does not support deletion/ + DeletionError + else + Error + end end end end