diff options
author | Bo Yang <teboring@google.com> | 2016-09-19 13:45:07 -0700 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2016-09-19 17:42:40 -0700 |
commit | 98835fb8f8a8f144f2a1eac0b833ff83f4a05f54 (patch) | |
tree | 49504df5c2020eb085c1826548c10a3cbd188e12 /conformance/conformance_python.py | |
parent | b5bbdb0967109fbae7bfc423ef3cd6dc776359b6 (diff) | |
download | protobuf-98835fb8f8a8f144f2a1eac0b833ff83f4a05f54.tar.gz protobuf-98835fb8f8a8f144f2a1eac0b833ff83f4a05f54.tar.bz2 protobuf-98835fb8f8a8f144f2a1eac0b833ff83f4a05f54.zip |
Integrate internal changes
Diffstat (limited to 'conformance/conformance_python.py')
-rwxr-xr-x | conformance/conformance_python.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/conformance/conformance_python.py b/conformance/conformance_python.py index a490c8e8..2f4a7812 100755 --- a/conformance/conformance_python.py +++ b/conformance/conformance_python.py @@ -67,7 +67,7 @@ def do_test(request): elif request.WhichOneof('payload') == 'json_payload': try: json_format.Parse(request.json_payload, test_message) - except json_format.ParseError as e: + except Exception as e: response.parse_error = str(e) return response @@ -81,7 +81,11 @@ def do_test(request): response.protobuf_payload = test_message.SerializeToString() elif request.requested_output_format == conformance_pb2.JSON: - response.json_payload = json_format.MessageToJson(test_message) + try: + response.json_payload = json_format.MessageToJson(test_message) + except Exception as e: + response.serialize_error = str(e) + return response except Exception as e: response.runtime_error = str(e) |