korbit-ai[bot] commented on code in PR #33164:
URL: https://github.com/apache/superset/pull/33164#discussion_r2049428254
##########
superset/sql_parse.py:
##########
@@ -277,6 +277,7 @@ def _extract_tables_from_sql(self) -> set[Table]:
"You may have an error in your SQL statement.
{message}"
).format(message=ex.error.message),
level=ErrorLevel.ERROR,
+ extra=ex.error.extra
Review Comment:
### Unsafe error attribute access <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The code assumes that a SupersetParseError will always have an error object
with an extra attribute, but this may not be guaranteed.
###### Why this matters
If the error object structure differs from expected, accessing
ex.error.extra could raise an AttributeError, causing a failure in error
handling itself.
###### Suggested change ∙ *Feature Preview*
Add a safe way to access the extra error information:
```python
extra=getattr(ex.error, 'extra', None) if hasattr(ex, 'error') else None
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/22729269-d51a-4321-84c7-8f3068d5bdc4/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/22729269-d51a-4321-84c7-8f3068d5bdc4?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/22729269-d51a-4321-84c7-8f3068d5bdc4?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/22729269-d51a-4321-84c7-8f3068d5bdc4?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/22729269-d51a-4321-84c7-8f3068d5bdc4)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:3b68dcd2-ccbc-4133-91a7-c6d8f29411bd -->
[](3b68dcd2-ccbc-4133-91a7-c6d8f29411bd)
--
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]