From 31bcd0114e46c904b705a1b0a9b7bd3460374384 Mon Sep 17 00:00:00 2001 From: Cheng Xing Date: Sat, 11 Jun 2022 00:10:19 +0000 Subject: [PATCH] Update error message when invalid sympy arg is serialized --- cirq-google/cirq_google/serialization/arg_func_langs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cirq-google/cirq_google/serialization/arg_func_langs.py b/cirq-google/cirq_google/serialization/arg_func_langs.py index 5d52387aea9..e545f07f830 100644 --- a/cirq-google/cirq_google/serialization/arg_func_langs.py +++ b/cirq-google/cirq_google/serialization/arg_func_langs.py @@ -190,7 +190,11 @@ def check_support(func_type: str) -> str: for arg in value.args: arg_to_proto(arg, arg_function_language=arg_function_language, out=msg.func.args.add()) else: - raise ValueError(f'Unrecognized arg type: {type(value)}') + raise ValueError( + f"Unrecognized Sympy expression type: {type(value)}." + " Only the following types are recognized: 'sympy.Symbol', 'sympy.Add', 'sympy.Mul'," + " 'sympy.Pow'." + ) def float_arg_from_proto(