lib/dor/services/client/metadata.rb in dor-services-client-4.12.0 vs lib/dor/services/client/metadata.rb in dor-services-client-4.13.0
- old
+ new
@@ -29,11 +29,11 @@
req.headers['Content-Type'] = 'application/json'
req.body = opts.to_json
end
return if resp.success?
- raise UnexpectedResponse, ResponseErrorFormatter.format(response: resp, object_identifier: object_identifier)
+ raise_exception_based_on_response!(resp, object_identifier)
end
# @return [String, NilClass] The Dublin Core XML representation of the object or nil if response is 404
# @raise [UnexpectedResponse] on an unsuccessful response from the server
def dublin_core
@@ -41,11 +41,11 @@
req.url "#{base_path}/dublin_core"
end
return resp.body if resp.success?
return if resp.status == 404
- raise UnexpectedResponse, ResponseErrorFormatter.format(response: resp, object_identifier: object_identifier)
+ raise_exception_based_on_response!(resp, object_identifier)
end
# @return [String, NilClass] The descriptive metadata XML representation of the object or nil if response is 404
# @raise [UnexpectedResponse] on an unsuccessful response from the server
def descriptive
@@ -53,10 +53,10 @@
req.url "#{base_path}/descriptive"
end
return resp.body if resp.success?
return if resp.status == 404
- raise UnexpectedResponse, ResponseErrorFormatter.format(response: resp, object_identifier: object_identifier)
+ raise_exception_based_on_response!(resp, object_identifier)
end
private
attr_reader :object_identifier