betodealmeida commented on a change in pull request #13244:
URL: https://github.com/apache/superset/pull/13244#discussion_r580456774



##########
File path: superset/db_engine_specs/base.py
##########
@@ -190,10 +205,27 @@ def get_dbapi_exception_mapping(cls) -> 
Dict[Type[Exception], Type[Exception]]:
 
         :return: A map of driver specific exception to superset custom 
exceptions
         """
-        return {}
+        dbapi_exception_names = {
+            "Error": SupersetDBAPIError,
+            "InterfaceError": SupersetDBAPIInterfaceError,
+            "DatabaseError": SupersetDBAPIDatabaseError,
+            "DataError": SupersetDBAPIDataError,
+            "OperationalError": SupersetDBAPIOperationalError,
+            "IntegrityError": SupersetDBAPIIntegrityError,
+            "InternalError": SupersetDBAPIInternalError,
+            "ProgrammingError": SupersetDBAPIProgrammingError,
+            "NotSupportedError": SupersetDBAPINotSupportedError,
+        }
+        return {
+            getattr(dbapi, exception_name): exception
+            for exception_name, exception in dbapi_exception_names.items()
+            if hasattr(dbapi, exception_name)
+        }

Review comment:
       Ha, it looks very similar: 
https://github.com/sqlalchemy/sqlalchemy/blob/640cd8a70f8a664b7834c5f74ec322fdea644043/lib/sqlalchemy/dialects/postgresql/pypostgresql.py#L90-L110
   
   But it's defined per dialect. I'll try to leverage that.




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

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