From 3caf9fd00a84d71c63c9fb873eb9befd70400153 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Wed, 26 Jul 2017 16:24:05 -0400 Subject: Review feedback. - Better error message for unknown messageType. - Remove unneeded if. --- conformance/conformance_objc.m | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'conformance/conformance_objc.m') diff --git a/conformance/conformance_objc.m b/conformance/conformance_objc.m index 6023fc78..84a43811 100644 --- a/conformance/conformance_objc.m +++ b/conformance/conformance_objc.m @@ -78,15 +78,13 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) { } else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) { msgClass = [TestAllTypesProto2 class]; } 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; - testMessage = [msgClass parseFromData:request.protobufPayload error:&error]; - if (!testMessage) { - response.parseError = - [NSString stringWithFormat:@"Parse error: %@", error]; - } + NSError *error = nil; + testMessage = [msgClass parseFromData:request.protobufPayload error:&error]; + if (!testMessage) { + response.parseError = + [NSString stringWithFormat:@"Parse error: %@", error]; } break; } -- cgit v1.2.3