You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/02/20 16:13:20 UTC

[GitHub] [incubator-superset] dpgaspar commented on a change in pull request #9178: [core] Fix, sanitize errors returned from testconn

dpgaspar commented on a change in pull request #9178: [core] Fix, sanitize errors returned from testconn
URL: https://github.com/apache/incubator-superset/pull/9178#discussion_r382102952
 
 

 ##########
 File path: superset/views/core.py
 ##########
 @@ -1330,11 +1335,32 @@ def testconn(self):
             with closing(engine.connect()) as conn:
                 conn.scalar(select([1]))
                 return json_success('"OK"')
-        except Exception as e:
-            logger.exception(e)
+        except NoSuchModuleError as e:
+            logger.info(f"Invalid driver {e}")
+            driver_name = make_url(uri).drivername
             return json_error_response(
-                "Connection failed!\n\n" f"The error message returned was:\n{e}", 400
+                _(
+                    "Could not load database driver: %(driver_name)s",
+                    driver_name=driver_name,
+                ),
+                400,
             )
+        except ArgumentError as e:
+            logger.info(f"Invalid URI {e}")
+            return json_error_response(
+                _(
+                    "Invalid connnection string, a valid string follows: \n"
+                    " 'DRIVER://USER:PASSWORD@DB-HOST/DATABASE-NAME'"
 
 Review comment:
   Done

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org