villebro commented on a change in pull request #9056: Do not show stacktraces 
on some intentionally-thrown errors
URL: 
https://github.com/apache/incubator-superset/pull/9056#discussion_r373761136
 
 

 ##########
 File path: superset/views/core.py
 ##########
 @@ -1363,7 +1363,9 @@ def testconn(self):
         except Exception as e:
             logging.exception(e)
             return json_error_response(
-                "Connection failed!\n\n" "The error message returned 
was:\n{}".format(e)
+                "Connection failed!\n\n"
+                "The error message returned was:\n{}".format(e),
 
 Review comment:
   As Superset moved to Python 3.6+, we now generally prefer to use f-strings 
over `"".format()` whenever possible. This is mostly due to f-strings being 
more readable, but they are usually also slightly more performant in normal 
usage. While the codebase is still filled with `format()`,when touching old 
code the convention has been to change them to f-strings. An exception to this 
rule is logging, which `pylint` (I believe) checks for, for which one should 
generally use `logger.debug('message: %s', c)` style. Check 
https://docs.python.org/3/howto/logging.html#optimization
   
   Hope this helps!

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to