dor-services-client 15.70.0 → 15.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/dor/services/client/version.rb +1 -1
- data/lib/dor/services/client/versioned_service.rb +13 -4
- data/lib/dor/services/client.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 730aef635e88c59d2124afc5c4a14bec8e5a1b6bc73e76726a647be01a97a420
|
|
4
|
+
data.tar.gz: 8f0b4402c3a91a00d186e15c0360d248f9f53363605702046919cba80b3ec091
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 914ba382636b58b9d0a257066b5c1d7a60cc94155157d1d5fad943d340750f66d04d04c3b61d0b74d8bcdf1310eb21dcb3eea004ac752da5cdd077eca63d8033
|
|
7
|
+
data.tar.gz: eb7e38f3a6ff299338a4178378c9aad9cff096dcf4fe68f260794fddae36422b930634ea4ff3ccf4d1d2ae0c5c8ade4d74cecfdef7a87a9e1da7888253230be7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -132,6 +132,7 @@ object_client.user_version.create(object_version: 3)
|
|
|
132
132
|
object_client.user_version.update(user_version: Dor::Services::Client::UserVersion::Version.new(version: 3, userVersion: 3, withdrawn: true))
|
|
133
133
|
|
|
134
134
|
# Return the Cocina metadata
|
|
135
|
+
# Raises Dor::Services::Client::InvalidCocinaError if the stored cocina is invalid.
|
|
135
136
|
object_client.find
|
|
136
137
|
|
|
137
138
|
# Return the Cocina metadata without the file sets (structural.contains), e.g., for objects with many files.
|
|
@@ -16,6 +16,9 @@ module Dor
|
|
|
16
16
|
|
|
17
17
|
JSON_API_MIME_TYPE = 'application/vnd.api+json'
|
|
18
18
|
|
|
19
|
+
# Title of the JSON:API error dor-services-app returns when stored cocina is invalid
|
|
20
|
+
INVALID_COCINA_TITLE = 'Invalid cocina'
|
|
21
|
+
|
|
19
22
|
def initialize(connection:, version:)
|
|
20
23
|
@connection = connection
|
|
21
24
|
@api_version = version
|
|
@@ -36,10 +39,16 @@ module Dor
|
|
|
36
39
|
else
|
|
37
40
|
{}
|
|
38
41
|
end
|
|
39
|
-
|
|
40
|
-
raise
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
errors = data.fetch('errors', [])
|
|
43
|
+
raise exception_class_for(response.status, errors).new(response: response,
|
|
44
|
+
object_identifier: object_identifier,
|
|
45
|
+
errors: errors)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def exception_class_for(status, errors)
|
|
49
|
+
return InvalidCocinaError if status == 500 && errors.first&.dig('title') == INVALID_COCINA_TITLE
|
|
50
|
+
|
|
51
|
+
EXCEPTION_CLASS.fetch(status, UnexpectedResponse)
|
|
43
52
|
end
|
|
44
53
|
|
|
45
54
|
def build_cocina_from_response(item, headers: nil, validate: false)
|
data/lib/dor/services/client.rb
CHANGED
|
@@ -84,6 +84,9 @@ module Dor
|
|
|
84
84
|
# This occurs when the request is well-formed but the content is not indexable
|
|
85
85
|
class UnprocessableContentError < UnexpectedResponse; end
|
|
86
86
|
|
|
87
|
+
# Error that is raised when dor-services-app returns a 500 because the stored cocina is invalid
|
|
88
|
+
class InvalidCocinaError < UnexpectedResponse; end
|
|
89
|
+
|
|
87
90
|
module Types
|
|
88
91
|
include Dry.Types()
|
|
89
92
|
end
|