Commit 036dad3f authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_data_notebook bt5: Exception catch for only json dump to make code more readable

parent ace10d25
...@@ -152,9 +152,10 @@ result = {\n ...@@ -152,9 +152,10 @@ result = {\n
}\n }\n
\n \n
# Catch exception while seriaizing the result to be passed to jupyter frontend\n # Catch exception while seriaizing the result to be passed to jupyter frontend\n
# and in case of error put code_result as None and status as \'error\' which would\n
# be shown by Jupyter frontend\n
try:\n try:\n
serialized_result = json.dumps(result)\n serialized_result = json.dumps(result)\n
data_notebook_line.edit(notebook_code_result=code_result)\n
except UnicodeDecodeError:\n except UnicodeDecodeError:\n
result = {\n result = {\n
u\'code_result\': None,\n u\'code_result\': None,\n
...@@ -164,7 +165,9 @@ except UnicodeDecodeError:\n ...@@ -164,7 +165,9 @@ except UnicodeDecodeError:\n
u\'status\': u\'error\'\n u\'status\': u\'error\'\n
}\n }\n
serialized_result = json.dumps(result)\n serialized_result = json.dumps(result)\n
\n \n
data_notebook_line.edit(notebook_code_result=code_result)\n
\n
return serialized_result\n return serialized_result\n
</string> </value> </string> </value>
</item> </item>
......
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