MIGRATING.md in google-cloud-container-1.1.0 vs MIGRATING.md in google-cloud-container-1.1.1

- old
+ new

@@ -24,10 +24,14 @@ * Previously, positional arguments were used to indicate required arguments. Now, all method arguments are keyword arguments, with documentation that specifies whether they are required or optional. Additionally, you can pass a proto request object instead of separate arguments. See [Passing Arguments](#passing-arguments) for more info. + * Previously, clients reported RPC errors by raising instances of + `Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type + `Google::Cloud::Error` and its subclasses. See + [Handling Errors](#handling-errors) for more info. * Some classes have moved into different namespaces. See [Class Namespaces](#class-namespaces) for more info. ### Library Structure @@ -204,9 +208,54 @@ # then add further keyword arguments for the call options. response = client.set_logging_service( { name: name, logging_service: logging_service }, timeout: 10.0 ) +``` + +### Handling Errors + +The client reports standard +[gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md) +by raising exceptions. In older releases, these exceptions were located in the +`Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base +exception class, defined in the `google-gax` gem. However, these classes were +different from the standard exceptions (subclasses of `Google::Cloud::Error`) +thrown by other client libraries such as `google-cloud-storage`. + +The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy, +for consistency across all the Google Cloud client libraries. In general, these +exceptions have the same name as their counterparts from older releases, but +are located in the `Google::Cloud` namespace rather than the `Google::Gax` +namespace. + +Old: +``` +client = Google::Cloud::Container.new + +name = "projects/my-project/locations/-/clusters/my-cluster" +logging_service = "logging.googleapis.com" + +begin + response = client.set_logging_service logging_service, name: name +rescue Google::Gax::Error => e + # Handle exceptions that subclass Google::Gax::Error +end +``` + +New: +``` +client = Google::Cloud::Container.cluster_manager + +name = "projects/my-project/locations/-/clusters/my-cluster" +logging_service = "logging.googleapis.com" + +begin + response = client.set_logging_service name: name, + logging_service: logging_service +rescue Google::Cloud::Error => e + # Handle exceptions that subclass Google::Cloud::Error +end ``` ### Class Namespaces In older releases, some data type (protobuf) classes were located under the module