Skip to content

Commit bcd9ffb

Browse files
fix(grpc): Address P1 code review issues - restore error_details export and fix deprecated Server constructor
ISSUE 1 - Missing error_details Export: - Re-export generated/google/rpc/error_details.pb.dart from lib/grpc.dart - Prevents breaking downstream code expecting BadRequest and other google.rpc error messages - Addresses: #8 (comment) ISSUE 2 - Deprecated Server Constructor Argument Order: - Fix argument forwarding in deprecated Server(...) constructor - Insert empty serverInterceptors list in super() call to maintain correct parameter positions - Prevents codecRegistry/errorHandler from being passed to wrong slots - Maintains backwards compatibility for existing code using deprecated constructor - Addresses: #8 (comment) VERIFICATION: - dart analyze: ✅ No issues - dart test: ✅ All 172 tests passing (+3 skipped) - dart format: ✅ Properly formatted - No breaking changes - fully backwards compatible RELATED: - PR: #8 - Codex review comments resolved
1 parent b19355f commit bcd9ffb

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

lib/grpc.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export 'src/client/options.dart'
3939
export 'src/client/proxy.dart' show Proxy;
4040
export 'src/client/transport/http2_credentials.dart'
4141
show BadCertificateHandler, allowBadCertificates, ChannelCredentials;
42+
export 'src/generated/google/rpc/error_details.pb.dart';
4243
export 'src/server/call.dart' show ServiceCall;
4344
export 'src/server/interceptor.dart'
4445
show Interceptor, ServerInterceptor, ServerStreamingInvoker;

lib/src/server/server.dart

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,21 @@ class Server extends ConnectionServer {
200200
/// Create a server for the given [services].
201201
@Deprecated('use Server.create() instead')
202202
Server(
203-
super.services, [
204-
super.interceptors,
205-
super.codecRegistry,
206-
super.errorHandler,
207-
super.keepAlive,
208-
]);
203+
List<Service> services, [
204+
List<Interceptor> interceptors = const <Interceptor>[],
205+
CodecRegistry? codecRegistry,
206+
GrpcErrorHandler? errorHandler,
207+
ServerKeepAliveOptions keepAlive = const ServerKeepAliveOptions(),
208+
]) : super(
209+
services,
210+
interceptors,
211+
const <
212+
ServerInterceptor
213+
>[], // Empty list for new serverInterceptors parameter
214+
codecRegistry,
215+
errorHandler,
216+
keepAlive,
217+
);
209218

210219
/// Create a server for the given [services].
211220
Server.create({

0 commit comments

Comments
 (0)