Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs

Issue 1983203003: Update third_party/protobuf to protobuf-v3.0.0-beta-3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: owners Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs
index 8f72c8f9b500a1a2a031196667bca2efb3f101d9..19827c4844587f444123580f5c6ac33cac8a29d5 100644
--- a/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs
+++ b/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs
@@ -101,15 +101,26 @@ namespace Google.Protobuf.Conformance
{
return new ConformanceResponse { ParseError = e.Message };
}
- switch (request.RequestedOutputFormat)
+ catch (InvalidJsonException e)
{
- case global::Conformance.WireFormat.JSON:
- var formatter = new JsonFormatter(new JsonFormatter.Settings(false, typeRegistry));
- return new ConformanceResponse { JsonPayload = formatter.Format(message) };
- case global::Conformance.WireFormat.PROTOBUF:
- return new ConformanceResponse { ProtobufPayload = message.ToByteString() };
- default:
- throw new Exception("Unsupported request output format: " + request.PayloadCase);
+ return new ConformanceResponse { ParseError = e.Message };
+ }
+ try
+ {
+ switch (request.RequestedOutputFormat)
+ {
+ case global::Conformance.WireFormat.Json:
+ var formatter = new JsonFormatter(new JsonFormatter.Settings(false, typeRegistry));
+ return new ConformanceResponse { JsonPayload = formatter.Format(message) };
+ case global::Conformance.WireFormat.Protobuf:
+ return new ConformanceResponse { ProtobufPayload = message.ToByteString() };
+ default:
+ throw new Exception("Unsupported request output format: " + request.PayloadCase);
+ }
+ }
+ catch (InvalidOperationException e)
+ {
+ return new ConformanceResponse { SerializeError = e.Message };
}
}

Powered by Google App Engine
This is Rietveld 408576698