lib/hyperkit/error.rb in hyperkit-1.0.0 vs lib/hyperkit/error.rb in hyperkit-1.0.2
- old
+ new
@@ -41,11 +41,11 @@
end
err
end
-
+
def self.from_async_operation(response)
return nil if response.nil? || response[:body].empty?
begin
@@ -104,19 +104,19 @@
[]
end
end
def self.error_for_500(response)
-
+
if response.body =~ /open: no such file or directory/i
Hyperkit::NotFound
elsif response.body =~ /open: is a directory/i
Hyperkit::BadRequest
- else
+ else
Hyperkit::InternalServerError
end
-
+
end
private
def data
@@ -144,11 +144,11 @@
end
end
def response_error
err = nil
-
+
if data.is_a?(Hash) && data[:error]
err = data[:error]
elsif data.is_a?(Hash) && data[:metadata]
err = data[:metadata][:err]
end
@@ -245,10 +245,10 @@
# Raised when a method requires an alias or a fingerprint, but
# none is provided
class ImageIdentifierRequired < StandardError; end
- # Raised when a method requires attributes of an alias to be
+ # Raised when a method requires attributes of an alias to be
# passed (e.g. description, traget), but none is provided
class AliasAttributesRequired < StandardError; end
# Raised when a method requires a protocol to be specified
# (e.g. "lxd" or "simplestreams"), but an invalid protocol is