From fc99ff6644e51297c4d20b686a62783161c8500b Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 6 Jul 2016 15:08:30 -0700 Subject: [PATCH] Fix error code when client run out of memory in Objective C code base Update Status Codes documentation --- doc/statuscodes.md | 1 + src/objective-c/GRPCClient/GRPCCall.m | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/statuscodes.md b/doc/statuscodes.md index c918f9ed9ab..1cd72df30ad 100644 --- a/doc/statuscodes.md +++ b/doc/statuscodes.md @@ -18,6 +18,7 @@ Only a subset of the pre-defined status codes are generated by the gRPC librarie | Could not decompress, but compression algorithm supported (Server -> Client) | INTERNAL | Client | | Compression mechanism used by client not supported at server | UNIMPLEMENTED | Server | | Server temporarily out of resources (e.g., Flow-control resource limits reached) | RESOURCE_EXHAUSTED | Server| +| Client does not have enough memory to hold the server response | RESOURCE_EXHAUSTED | Client | | Flow-control protocol violation | INTERNAL | Both | | Error parsing returned status | UNKNOWN | Client | | Incorrect Auth metadata ( Credentials failed to get metadata, Incompatible credentials set on channel and call, Invalid host set in `:authority` metadata, etc.) | UNAUTHENTICATED | Both | diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index e9678f38a9c..71121094afd 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -213,8 +213,8 @@ NSString * const kGRPCTrailersKey = @"io.grpc.TrailersKey"; // (because it's just a client problem). Use another domain and an // appropriately-documented code. [weakSelf finishWithError:[NSError errorWithDomain:kGRPCErrorDomain - code:GRPCErrorCodeInternal - userInfo:nil]]; + code:GRPCErrorCodeResourceExhausted + userInfo:@{NSLocalizedDescriptionKey: @"Client out of memory."}]]; [weakSelf cancelCall]; return; }