nicknezis commented on a change in pull request #3786:
URL: https://github.com/apache/incubator-heron/pull/3786#discussion_r835995379



##########
File path: heron/tools/ui/src/python/main.py
##########
@@ -316,17 +347,25 @@ class ApiEnvelope(pydantic.BaseModel):
   executiontime: int
   result: dict
 
-
 def api_topology_json(method: Callable[[], dict]) -> ApiEnvelope:
   """Wrap the output of a method with a response envelope."""
   started = time.time()
   result = method()
-  return ApiEnvelope(
-      status="success",
-      message="",
-      executiontime=time.time() - started,
-      result=result,
-  )
+  Log.debug(f"Api topology: {result}")
+  if type(result) is None:
+    return ApiEnvelope(
+        status="failure",
+        message="No topology found",
+        executiontime=time.time() - started,
+        result={},
+    )
+  else:
+    return ApiEnvelope(
+        status="success",
+        message="",
+        executiontime=time.time() - started,
+        result=result,
+    )

Review comment:
       Should it be `if result is None:` or do you recommend I remove the `if` 
statement?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to