mirror of
https://github.com/apache/superset.git
synced 2026-05-07 08:54:23 +00:00
fix(log): don't log exceptions on test connection (#10522)
* fix(log): don't log exceptions on test connection * fix lint
This commit is contained in:
committed by
Ville Brofeldt
parent
13928fcf2d
commit
fb60d302c2
@@ -1125,10 +1125,10 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
|
||||
conn.scalar(select([1]))
|
||||
return json_success('"OK"')
|
||||
except CertificateException as ex:
|
||||
logger.info(ex.message)
|
||||
logger.info("Certificate exception")
|
||||
return json_error_response(ex.message)
|
||||
except (NoSuchModuleError, ModuleNotFoundError) as ex:
|
||||
logger.info("Invalid driver %s", ex)
|
||||
except (NoSuchModuleError, ModuleNotFoundError):
|
||||
logger.info("Invalid driver")
|
||||
driver_name = make_url(uri).drivername
|
||||
return json_error_response(
|
||||
_(
|
||||
@@ -1137,24 +1137,24 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
|
||||
),
|
||||
400,
|
||||
)
|
||||
except ArgumentError as ex:
|
||||
logger.info("Invalid URI %s", ex)
|
||||
except ArgumentError:
|
||||
logger.info("Invalid URI")
|
||||
return json_error_response(
|
||||
_(
|
||||
"Invalid connection string, a valid string usually follows:\n"
|
||||
"'DRIVER://USER:PASSWORD@DB-HOST/DATABASE-NAME'"
|
||||
)
|
||||
)
|
||||
except OperationalError as ex:
|
||||
logger.warning("Connection failed %s", ex)
|
||||
except OperationalError:
|
||||
logger.warning("Connection failed")
|
||||
return json_error_response(
|
||||
_("Connection failed, please check your connection settings."), 400
|
||||
_("Connection failed, please check your connection settings"), 400
|
||||
)
|
||||
except DBSecurityException as ex:
|
||||
logger.warning("Stopped an unsafe database connection. %s", ex)
|
||||
logger.warning("Stopped an unsafe database connection")
|
||||
return json_error_response(_(str(ex)), 400)
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
logger.error("Unexpected error %s", ex)
|
||||
logger.error("Unexpected error %s", type(ex).__name__)
|
||||
return json_error_response(
|
||||
_("Unexpected error occurred, please check your logs for details"), 400
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user