Commit 3caf9fd0 authored by Thomas Van Lenten's avatar Thomas Van Lenten

Review feedback.

- Better error message for unknown messageType.
- Remove unneeded if.
parent c2831a34
...@@ -78,15 +78,13 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) { ...@@ -78,15 +78,13 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
} else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) { } else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) {
msgClass = [TestAllTypesProto2 class]; msgClass = [TestAllTypesProto2 class];
} else { } else {
Die(@"Protobuf request doesn't have specific payload type"); Die(@"Protobuf request had an unknown message_type: %@", request.messageType);
} }
if (msgClass) { NSError *error = nil;
NSError *error = nil; testMessage = [msgClass parseFromData:request.protobufPayload error:&error];
testMessage = [msgClass parseFromData:request.protobufPayload error:&error]; if (!testMessage) {
if (!testMessage) { response.parseError =
response.parseError = [NSString stringWithFormat:@"Parse error: %@", error];
[NSString stringWithFormat:@"Parse error: %@", error];
}
} }
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment