Skip to content

Commit

Permalink
Use runtime_error vs just exiting for some issues.
Browse files Browse the repository at this point in the history
release notes: no
  • Loading branch information
thomasvl committed May 29, 2019
1 parent 37297b2 commit beaeaed
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions conformance/conformance_objc.m
Expand Up @@ -68,7 +68,8 @@ static void Die(NSString *format, ...) {

switch (request.payloadOneOfCase) {
case ConformanceRequest_Payload_OneOfCase_GPBUnsetOneOfCase:
Die(@"Request didn't have a payload: %@", request);
response.runtimeError =
[NSString stringWithFormat:@"Request didn't have a payload: %@", request];
break;

case ConformanceRequest_Payload_OneOfCase_ProtobufPayload: {
Expand All @@ -78,7 +79,10 @@ static void Die(NSString *format, ...) {
} else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) {
msgClass = [TestAllTypesProto2 class];
} else {
Die(@"Protobuf request had an unknown message_type: %@", request.messageType);
response.runtimeError =
[NSString stringWithFormat:
@"Protobuf request had an unknown message_type: %@", request.messageType];
break;
}
NSError *error = nil;
testMessage = [msgClass parseFromData:request.protobufPayload error:&error];
Expand Down Expand Up @@ -108,7 +112,8 @@ static void Die(NSString *format, ...) {
switch (request.requestedOutputFormat) {
case WireFormat_GPBUnrecognizedEnumeratorValue:
case WireFormat_Unspecified:
Die(@"Unrecognized/unspecified output format: %@", request);
response.runtimeError =
[NSString stringWithFormat:@"Unrecognized/unspecified output format: %@", request];
break;

case WireFormat_Protobuf:
Expand Down

0 comments on commit beaeaed

Please sign in to comment.