etr2460 commented on code in PR #20823:
URL: https://github.com/apache/superset/pull/20823#discussion_r972481872


##########
superset-frontend/src/dashboard/components/PropertiesModal/index.tsx:
##########
@@ -294,7 +296,12 @@ const PropertiesModal = ({
 
     // color scheme in json metadata has precedence over selection
     if (currentJsonMetadata?.length) {
-      const metadata = JSON.parse(currentJsonMetadata);
+      let metadata;
+      try {
+        metadata = JSON.parse(currentJsonMetadata);
+      } catch (error) {
+        addDangerToast(t('JSON metadata is invalid!'));

Review Comment:
   @zhaoyongjie shouldn't this re-throw the error (or at least return from the 
function) if we don't have valid metadata here so we don't try to save an 
invalid payload?



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