google-cloud-errors 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/errors/version.rb +1 -1
- data/lib/google/cloud/errors.rb +25 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ab6400a7d633ba4c9bb30de49bc2b23a5824530fa02a1f88aa151ff328487ab
|
4
|
+
data.tar.gz: 77459bb92f7408eb68b9d02ed6b96cd4d3f183d213c27b1eac36086129957424
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9cbd068fecd4fa411fd008bc519460366900be46f774ead0c5e92b399f46c8ec1f9cf02e2971dafdc86106f177e48073720faf2a6135c09f8bc80bf8eded0e6
|
7
|
+
data.tar.gz: 5f54fe580d61ce5e0d1b80b13a461e3d299c888e770646328df796e662093c0e1a1cfae1996a3b5c91307673e372400f267caa0d0bb54c67c5d1fbdb51947b10
|
data/lib/google/cloud/errors.rb
CHANGED
@@ -23,6 +23,8 @@ module Google
|
|
23
23
|
##
|
24
24
|
# Construct a new Google::Cloud::Error object, optionally passing in a
|
25
25
|
# message.
|
26
|
+
#
|
27
|
+
# @param msg [String, nil] an error message
|
26
28
|
def initialize msg = nil
|
27
29
|
super
|
28
30
|
end
|
@@ -119,19 +121,26 @@ module Google
|
|
119
121
|
end
|
120
122
|
|
121
123
|
##
|
122
|
-
# Returns the `::Google::Rpc::ErrorInfo` object present in `status_details`
|
123
|
-
# given that the following is true:
|
124
|
-
# * `status_details` exists and is an array
|
125
|
-
# * there is exactly one `::Google::Rpc::ErrorInfo` object in
|
124
|
+
# Returns the `::Google::Rpc::ErrorInfo` object present in the `status_details`
|
125
|
+
# or `details` array, given that the following is true:
|
126
|
+
# * either `status_details` or `details` exists and is an array
|
127
|
+
# * there is exactly one `::Google::Rpc::ErrorInfo` object in that array.
|
128
|
+
# Looks in `status_details` first, then in `details`.
|
126
129
|
#
|
127
130
|
# @return [::Google::Rpc::ErrorInfo, nil]
|
128
131
|
def error_info
|
129
|
-
@error_info ||=
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
132
|
+
@error_info ||= begin
|
133
|
+
check_property = lambda do |prop|
|
134
|
+
if prop.is_a? Array
|
135
|
+
error_infos = prop.find_all { |status| status.is_a?(::Google::Rpc::ErrorInfo) }
|
136
|
+
if error_infos.length == 1
|
137
|
+
error_infos[0]
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
check_property.call(status_details) || check_property.call(details)
|
143
|
+
end
|
135
144
|
end
|
136
145
|
|
137
146
|
##
|
@@ -272,12 +281,6 @@ module Google
|
|
272
281
|
class PermissionDeniedError < Error
|
273
282
|
end
|
274
283
|
|
275
|
-
##
|
276
|
-
# Unauthenticated indicates the request does not have valid
|
277
|
-
# authentication credentials for the operation.
|
278
|
-
class UnauthenticatedError < Error
|
279
|
-
end
|
280
|
-
|
281
284
|
##
|
282
285
|
# ResourceExhausted indicates some resource has been exhausted, perhaps
|
283
286
|
# a per-user quota, or perhaps the entire file system is out of space.
|
@@ -363,5 +366,11 @@ module Google
|
|
363
366
|
# DataLoss indicates unrecoverable data loss or corruption.
|
364
367
|
class DataLossError < Error
|
365
368
|
end
|
369
|
+
|
370
|
+
##
|
371
|
+
# Unauthenticated indicates the request does not have valid
|
372
|
+
# authentication credentials for the operation.
|
373
|
+
class UnauthenticatedError < Error
|
374
|
+
end
|
366
375
|
end
|
367
376
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-09-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: autotest-suffix
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
|
-
rubygems_version: 3.
|
189
|
+
rubygems_version: 3.3.14
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: Error classes for google-cloud-ruby
|