bito-code-review[bot] commented on code in PR #44028:
URL: https://github.com/apache/superset/pull/44028#discussion_r4064713341


##########
superset/dashboards/api.py:
##########
@@ -2750,6 +2752,8 @@ def copy_dash(self, original_dash: Dashboard) -> Response:
             dash = CopyDashboardCommand(original_dash, data).run()
         except DashboardForbiddenError:
             return self.response_403()
+        except DashboardInvalidError as ex:
+            return self.response_422(message=ex.normalized_messages())

Review Comment:
   <!-- Bito Reply -->
   The suggestion to handle `DashboardInvalidError` by returning 
`self.response_422(message=ex.normalized_messages())` is appropriate. Since 
`normalized_messages()` returns an empty dictionary when no validation errors 
are present, the fallback behavior in Flask-AppBuilder ensures a non-empty 
response body, which is consistent with the behavior you observed. This change 
correctly surfaces structured validation errors when they exist, while 
maintaining a valid response format when they do not.
   
   **superset/dashboards/api.py**
   ```
   except DashboardForbiddenError:
               return self.response_403()
           except DashboardInvalidError as ex:
               return self.response_422(message=ex.normalized_messages())
   ```



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