alexandrusoare commented on code in PR #42796:
URL: https://github.com/apache/superset/pull/42796#discussion_r3749949155


##########
superset/views/error_handling.py:
##########
@@ -74,12 +79,20 @@ def json_error_response(
 ) -> FlaskResponse:
     payload = payload or {}
 
+    if isinstance(error_details, SupersetError):
+        error_details = [error_details]
+
     if isinstance(error_details, list):
-        payload["errors"] = [dataclasses.asdict(error) for error in 
error_details]
-    elif isinstance(error_details, SupersetError):
-        payload["errors"] = [dataclasses.asdict(error_details)]
+        payload["errors"] = [
+            dataclasses.asdict(error)
+            for error in sanitize_superset_errors(error_details)
+        ]
     elif isinstance(error_details, str):
-        payload["error"] = error_details
+        payload["error"] = (
+            error_details
+            if status in SAFE_STATUSES
+            else sanitize_error_message(error_details)
+        )

Review Comment:
   What do you think of this comment?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to