google-cloud-language 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0e161151fa7a8c3ceaa9a034696d7831d8914541629ade9d5b75b9758b59b22
4
- data.tar.gz: d849567e45b3b163e85842190047cec6b2df94867409df9e6632e41ef60287d1
3
+ metadata.gz: dc1193cbacb5d36f6b34cfab3d90e39e68c1ebe00014fc830589f697b1c2b102
4
+ data.tar.gz: e7646dcbb3930c4b2eb8cd9c675394431b7ef381ee91ee6e6948364ddd71e3c5
5
5
  SHA512:
6
- metadata.gz: 91ab7af520fc9138a7562ea21a10059f1c0f8a35994a1aa8b9af510c9b74c681e62f9917fe1a61c25832c36e4f82f2f19edaa5f8348f3292a59e18a13c572df9
7
- data.tar.gz: 79e65cb79e1ca8b87f1334fde53887e1685d271d045c13c83f9235f9ac4e7a56dd8671bcfaddb504b5c7fc129aebb692146428abd2d2fff1cfc20549aa2d6a0e
6
+ metadata.gz: 9e75189339140c7dfd71b1b71dc6b67f73beec0a6fc05529b027b29515ff2bf3ec7bbcbc6de6890f5eb0a079c3b14d4c66328702f2c17ab58deb0ac7041b4c41
7
+ data.tar.gz: 768af4b94d592bf21d0199c10dcc1b3ee19c81380cad10fd245e4e915236aa2eb3bb2a91fd63d280b9edcdb8efb12f924263c8496974a8369f86bdf887669c66
@@ -26,6 +26,10 @@ To summarize:
26
26
  specifies whether they are required or optional. Additionally, you can pass
27
27
  a proto request object instead of separate arguments. See
28
28
  [Passing Arguments](#passing-arguments) for more info.
29
+ * Previously, clients reported RPC errors by raising instances of
30
+ `Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
31
+ `Google::Cloud::Error` and its subclasses. See
32
+ [Handling Errors](#handling-errors) for more info.
29
33
  * Some classes have moved into different namespaces. See
30
34
  [Class Namespaces](#class-namespaces) for more info.
31
35
 
@@ -216,6 +220,56 @@ response = client.analyze_sentiment(
216
220
  )
217
221
  ```
218
222
 
223
+ ### Handling Errors
224
+
225
+ The client reports standard
226
+ [gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
227
+ by raising exceptions. In older releases, these exceptions were located in the
228
+ `Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
229
+ exception class, defined in the `google-gax` gem. However, these classes were
230
+ different from the standard exceptions (subclasses of `Google::Cloud::Error`)
231
+ thrown by other client libraries such as `google-cloud-storage`.
232
+
233
+ The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy,
234
+ for consistency across all the Google Cloud client libraries. In general, these
235
+ exceptions have the same name as their counterparts from older releases, but
236
+ are located in the `Google::Cloud` namespace rather than the `Google::Gax`
237
+ namespace.
238
+
239
+ Old:
240
+ ```
241
+ client = Google::Cloud::Language.new
242
+
243
+ document = {
244
+ content: "I love API calls!",
245
+ type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
246
+ }
247
+ encoding = Google:Cloud::Language::V1::EncodingType::UTF8
248
+
249
+ begin
250
+ response = client.analyze_sentiment document, encoding_type: encoding
251
+ rescue Google::Gax::Error => e
252
+ # Handle exceptions that subclass Google::Gax::Error
253
+ end
254
+ ```
255
+
256
+ New:
257
+ ```
258
+ client = Google::Cloud::Language.language_service
259
+
260
+ document = {
261
+ content: "I love API calls!",
262
+ type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
263
+ }
264
+ encoding = Google:Cloud::Language::V1::EncodingType::UTF8
265
+
266
+ begin
267
+ response = client.analyze_sentiment document: document, encoding_type: encoding
268
+ rescue Google::Cloud::Error => e
269
+ # Handle exceptions that subclass Google::Cloud::Error
270
+ end
271
+ ```
272
+
219
273
  ### Class Namespaces
220
274
 
221
275
  In older releases, the client object was of class
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Language
19
- VERSION = "1.2.0".freeze
19
+ VERSION = "1.2.1".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-language
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-20 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core