justinpark commented on code in PR #25669:
URL: https://github.com/apache/superset/pull/25669#discussion_r1366213091


##########
superset/datasets/commands/create.py:
##########
@@ -49,10 +50,14 @@ def run(self) -> Model:
             # Updates columns and metrics from the dataset
             dataset.fetch_metadata(commit=False)
             db.session.commit()
-        except (SQLAlchemyError, DAOCreateFailedError) as ex:
+        except (SQLAlchemyError, DAOCreateFailedError, 
SupersetSecurityException) as ex:
             logger.warning(ex, exc_info=True)
             db.session.rollback()
-            raise DatasetCreateFailedError() from ex
+            raise DatasetCreateFailedError(
+                *{"message": str(ex)}
+                if isinstance(ex, SupersetSecurityException)

Review Comment:
   @john-bodley Overwrite the message only if the error is a 
SupersetSecurityException, since other cases are just "Create failed" and the 
DatasetCreateFailedError message is more informative.
   
   ```
     - {'message': 'Dataset could not be created.'}
     + {'message': 'Create failed'}
   ```



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