korbit-ai[bot] commented on code in PR #35237:
URL: https://github.com/apache/superset/pull/35237#discussion_r2371067474


##########
superset/views/base.py:
##########
@@ -596,7 +591,7 @@ def _delete(self: BaseView, primary_key: int) -> None:
         try:
             self.pre_delete(item)
         except Exception as ex:  # pylint: disable=broad-except
-            flash(str(ex), "danger")
+            logger.error("Pre-delete error: %s", str(ex))

Review Comment:
   ### Redundant string conversion in logging <sub>![category 
Performance](https://img.shields.io/badge/Performance-4f46e5)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   Unnecessary string conversion of exception object in logging statement.
   
   
   ###### Why this matters
   The `str()` conversion is redundant since Python's logging module 
automatically converts exception objects to strings when formatting log 
messages, adding unnecessary overhead.
   
   ###### Suggested change ∙ *Feature Preview*
   Remove the `str()` wrapper and pass the exception directly to the logger:
   ```python
   logger.error("Pre-delete error: %s", ex)
   ```
   
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3da31ce2-dd76-4c71-8b99-e1708a78860f/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3da31ce2-dd76-4c71-8b99-e1708a78860f?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3da31ce2-dd76-4c71-8b99-e1708a78860f?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3da31ce2-dd76-4c71-8b99-e1708a78860f?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/3da31ce2-dd76-4c71-8b99-e1708a78860f)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:c251890c-96a5-4c64-8394-6e6dfa5a9078 -->
   
   
   [](c251890c-96a5-4c64-8394-6e6dfa5a9078)



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