Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add decoded grpc-status-details-bin details to GrpcError #349

Merged
merged 27 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d197e98
Add status details as Uint8List to GrpcError
acoutts Sep 14, 2020
9d08aee
Handle case where grpc-status-details-bin might be null
acoutts Sep 14, 2020
d7f806f
Added handling of all detail Any types such as RetryInfo and BadRequest
acoutts Sep 14, 2020
bf63427
Add export for status detail types to for easier consumption
acoutts Sep 14, 2020
df0ba21
Add export for generated error details and cleanup empty space
acoutts Sep 14, 2020
e6049a4
Replace StatusCode implementation with auto-generated equivalent from…
acoutts Sep 14, 2020
2600cc1
Revert "Replace StatusCode implementation with auto-generated equival…
acoutts Sep 14, 2020
32f30c6
Added status code name to GrpcError
acoutts Sep 14, 2020
7076f88
Fixed status code parsing to be consistent | Fixed status code name p…
acoutts Sep 14, 2020
f970c33
Bump protobuf dependency in examples and interop
acoutts Sep 16, 2020
bc2ef04
Merge pull request #1 from grpc/master
acoutts Sep 16, 2020
d41778c
Merge pull request #2 from bottlepay/master
acoutts Sep 16, 2020
490b2b9
Fix googleapis generated protobuf files by running generator again
acoutts Sep 17, 2020
f06943d
Added unit tests for extracting error details from grpc-status-detail…
acoutts Sep 17, 2020
6d734ec
Merge branch 'master' into add-status-details
acoutts Sep 17, 2020
a72916d
Bumped version and added changelog entry
acoutts Sep 17, 2020
0b9dc16
Merged master
acoutts Sep 21, 2020
9b94792
Updated readme to include how to use the regenerate.sh script to upda…
acoutts Sep 21, 2020
977f2fc
Removed todos related to parsing headers
acoutts Sep 21, 2020
cd19716
More code review fixes
acoutts Sep 21, 2020
058303a
Fixes for code review
acoutts Sep 22, 2020
b8ffd50
Add return carriage to last line of readme
acoutts Sep 23, 2020
150268e
Improve comment for decodeStatusDetails
acoutts Sep 23, 2020
d2d41f9
Merge remote-tracking branch 'upstream/master' into add-status-details
acoutts Sep 23, 2020
d5db793
Bump pubspec version
acoutts Sep 23, 2020
97fa899
Bump version and add DS_Store to gitignore
acoutts Oct 26, 2020
afa92e3
Merge master from upstream
acoutts Oct 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.3.0
* Added parsing of response error details from `grpc-status-details-bin` to provide access to all provided exception details in the `GrpcError` thrown in Dart, via [#349](https://github.com/grpc/grpc-dart/pull/349).

## 2.2.0+1

* Relax `crypto` version dependency constraint from `^2.1.5` to `^2.1.4`.
Expand Down
42 changes: 26 additions & 16 deletions example/googleapis/lib/src/generated/google/api/label.pb.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
///
// Generated code. Do not modify.
// source: google/api/label.proto
///
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name
//
// @dart = 2.3
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type

import 'dart:core' as $core
show bool, Deprecated, double, int, List, Map, override, pragma, String;
import 'dart:core' as $core;

import 'package:protobuf/protobuf.dart' as $pb;

Expand All @@ -15,15 +15,12 @@ export 'label.pbenum.dart';

class LabelDescriptor extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo('LabelDescriptor',
package: const $pb.PackageName('google.api'))
package: const $pb.PackageName('google.api'), createEmptyInstance: create)
..aOS(1, 'key')
..e<LabelDescriptor_ValueType>(
2,
'valueType',
$pb.PbFieldType.OE,
LabelDescriptor_ValueType.STRING,
LabelDescriptor_ValueType.valueOf,
LabelDescriptor_ValueType.values)
..e<LabelDescriptor_ValueType>(2, 'valueType', $pb.PbFieldType.OE,
defaultOrMaker: LabelDescriptor_ValueType.STRING,
valueOf: LabelDescriptor_ValueType.valueOf,
enumValues: LabelDescriptor_ValueType.values)
..aOS(3, 'description')
..hasRequiredFields = false;

Expand All @@ -44,31 +41,44 @@ class LabelDescriptor extends $pb.GeneratedMessage {
LabelDescriptor createEmptyInstance() => create();
static $pb.PbList<LabelDescriptor> createRepeated() =>
$pb.PbList<LabelDescriptor>();
static LabelDescriptor getDefault() =>
_defaultInstance ??= create()..freeze();
@$core.pragma('dart2js:noInline')
static LabelDescriptor getDefault() => _defaultInstance ??=
$pb.GeneratedMessage.$_defaultFor<LabelDescriptor>(create);
static LabelDescriptor _defaultInstance;

$core.String get key => $_getS(0, '');
@$pb.TagNumber(1)
$core.String get key => $_getSZ(0);
@$pb.TagNumber(1)
set key($core.String v) {
$_setString(0, v);
}

@$pb.TagNumber(1)
$core.bool hasKey() => $_has(0);
@$pb.TagNumber(1)
void clearKey() => clearField(1);

@$pb.TagNumber(2)
LabelDescriptor_ValueType get valueType => $_getN(1);
@$pb.TagNumber(2)
set valueType(LabelDescriptor_ValueType v) {
setField(2, v);
}

@$pb.TagNumber(2)
$core.bool hasValueType() => $_has(1);
@$pb.TagNumber(2)
void clearValueType() => clearField(2);

$core.String get description => $_getS(2, '');
@$pb.TagNumber(3)
$core.String get description => $_getSZ(2);
@$pb.TagNumber(3)
set description($core.String v) {
$_setString(2, v);
}

@$pb.TagNumber(3)
$core.bool hasDescription() => $_has(2);
@$pb.TagNumber(3)
void clearDescription() => clearField(3);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
///
// Generated code. Do not modify.
// source: google/api/label.proto
///
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name
//
// @dart = 2.3
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type

// ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME
import 'dart:core' as $core show int, dynamic, String, List, Map;
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;

class LabelDescriptor_ValueType extends $pb.ProtobufEnum {
Expand Down
27 changes: 14 additions & 13 deletions example/googleapis/lib/src/generated/google/api/label.pbjson.dart
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
///
// Generated code. Do not modify.
// source: google/api/label.proto
///
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name
//
// @dart = 2.3
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type

const LabelDescriptor$json = {
const LabelDescriptor$json = const {
'1': 'LabelDescriptor',
'2': [
{'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
{
'2': const [
const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
const {
'1': 'value_type',
'3': 2,
'4': 1,
'5': 14,
'6': '.google.api.LabelDescriptor.ValueType',
'10': 'valueType'
},
{'1': 'description', '3': 3, '4': 1, '5': 9, '10': 'description'},
const {'1': 'description', '3': 3, '4': 1, '5': 9, '10': 'description'},
],
'4': [LabelDescriptor_ValueType$json],
'4': const [LabelDescriptor_ValueType$json],
};

const LabelDescriptor_ValueType$json = {
const LabelDescriptor_ValueType$json = const {
'1': 'ValueType',
'2': [
{'1': 'STRING', '2': 0},
{'1': 'BOOL', '2': 1},
{'1': 'INT64', '2': 2},
'2': const [
const {'1': 'STRING', '2': 0},
const {'1': 'BOOL', '2': 1},
const {'1': 'INT64', '2': 2},
],
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
///
// Generated code. Do not modify.
// source: google/api/launch_stage.proto
///
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name
//
// @dart = 2.3
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type

import 'dart:core' as $core
show bool, Deprecated, double, int, List, Map, override, pragma, String;
import 'dart:core' as $core;

export 'launch_stage.pbenum.dart';
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
///
// Generated code. Do not modify.
// source: google/api/launch_stage.proto
///
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name
//
// @dart = 2.3
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type

// ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME
import 'dart:core' as $core show int, dynamic, String, List, Map;
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;

class LaunchStage extends $pb.ProtobufEnum {
static const LaunchStage LAUNCH_STAGE_UNSPECIFIED =
LaunchStage._(0, 'LAUNCH_STAGE_UNSPECIFIED');
static const LaunchStage UNIMPLEMENTED = LaunchStage._(6, 'UNIMPLEMENTED');
static const LaunchStage PRELAUNCH = LaunchStage._(7, 'PRELAUNCH');
static const LaunchStage EARLY_ACCESS = LaunchStage._(1, 'EARLY_ACCESS');
static const LaunchStage ALPHA = LaunchStage._(2, 'ALPHA');
static const LaunchStage BETA = LaunchStage._(3, 'BETA');
Expand All @@ -19,6 +22,8 @@ class LaunchStage extends $pb.ProtobufEnum {

static const $core.List<LaunchStage> values = <LaunchStage>[
LAUNCH_STAGE_UNSPECIFIED,
UNIMPLEMENTED,
PRELAUNCH,
EARLY_ACCESS,
ALPHA,
BETA,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
///
// Generated code. Do not modify.
// source: google/api/launch_stage.proto
///
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name
//
// @dart = 2.3
// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type

const LaunchStage$json = {
const LaunchStage$json = const {
'1': 'LaunchStage',
'2': [
{'1': 'LAUNCH_STAGE_UNSPECIFIED', '2': 0},
{'1': 'EARLY_ACCESS', '2': 1},
{'1': 'ALPHA', '2': 2},
{'1': 'BETA', '2': 3},
{'1': 'GA', '2': 4},
{'1': 'DEPRECATED', '2': 5},
'2': const [
const {'1': 'LAUNCH_STAGE_UNSPECIFIED', '2': 0},
const {'1': 'UNIMPLEMENTED', '2': 6},
const {'1': 'PRELAUNCH', '2': 7},
const {'1': 'EARLY_ACCESS', '2': 1},
const {'1': 'ALPHA', '2': 2},
const {'1': 'BETA', '2': 3},
const {'1': 'GA', '2': 4},
const {'1': 'DEPRECATED', '2': 5},
],
};
Loading