Skip to content

Commit bc1865b

Browse files
authored
feat(dart): Support a revised exception hierarchy (#3429)
Pairs with googleapis/google-cloud-dart#101 Also removes `typedDataImport` (cleanup).
1 parent 2a71c8d commit bc1865b

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

internal/sidekick/dart/annotate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ func (annotate *annotateModel) annotateModel(options map[string]string) error {
381381
// Add the import for ServiceClient and related functionality.
382382
if len(model.Services) > 0 {
383383
annotate.imports[serviceClientImport] = true
384+
annotate.imports[serviceExceptionImport] = true
384385
}
385386

386387
// `protobuf.dart` defines `JsonEncodable`, which is needed by any API that defines an `enum` or `message`.

internal/sidekick/dart/dart.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ import (
2828
)
2929

3030
const (
31-
typedDataImport = "dart:typed_data"
32-
httpImport = "package:http/http.dart as http"
33-
serviceClientImport = "package:google_cloud_rpc/service_client.dart"
34-
encodingImport = "package:google_cloud_protobuf/src/encoding.dart"
35-
protobufImport = "package:google_cloud_protobuf/protobuf.dart"
31+
httpImport = "package:http/http.dart as http"
32+
serviceClientImport = "package:google_cloud_rpc/service_client.dart"
33+
serviceExceptionImport = "package:google_cloud_rpc/exceptions.dart"
34+
encodingImport = "package:google_cloud_protobuf/src/encoding.dart"
35+
protobufImport = "package:google_cloud_protobuf/protobuf.dart"
3636
)
3737

3838
var needsCtorValidation = map[string]string{

internal/sidekick/dart/templates/lib/method.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ limitations under the License.
1919
{{/Codec.DocLines}}
2020
///
2121
/// Throws a [http.ClientException] if there were problems communicating with
22-
/// the API service. Throws a [StatusException] if the API failed with a
23-
/// [Status] message. Throws a [ServiceException] for any other failure.
22+
/// the API service. Throws a [ServiceException] if the API method failed for
23+
/// any reason.
2424
{{#Codec.ServerSideStreaming}}
2525
Stream<{{Codec.ResponseType}}> {{Codec.Name}}({{Codec.RequestType}} request) {
2626
final url = Uri.https(_host, '{{PathInfo.Codec.PathFmt}}'

0 commit comments

Comments
 (0)