DamianPendrak opened a new pull request, #34674:
URL: https://github.com/apache/superset/pull/34674

   <!---
   Please write the PR title following the conventions at 
https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   Introduce `CUSTOM_DATABASE_ERRORS` in the config to replace raw database 
exceptions with a custom message and optional documentation links.
   
   `custom_doc_links` - contains links that will show after the error message
   `show_issue_info` - if set to False, hides the "See more" button that 
contains the issue code and link to Superset documentation
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   #### Before
   <img width="1722" height="495" alt="Screenshot 2025-08-12 at 09 40 07" 
src="https://github.com/user-attachments/assets/92a783ef-6365-4b12-ac52-4c1350e8f94e";
 />
   
   #### After
   <img width="1728" height="485" alt="Screenshot 2025-08-12 at 09 43 44" 
src="https://github.com/user-attachments/assets/03d66701-368d-48f2-9086-ec4670d79a31";
 />
   
   ### TESTING INSTRUCTIONS
   1. In SQL Lab, run a query that results in a database error, ex. "SELECT * 
FROM non_existing_table"
   2. Find a string that will match this error with a regex, ex. 
"TrinoUserError"
   3. Add `CUSTOM_DATABASE_ERRORS` to `superset_config.py` with this structure:
   ```Python
   CUSTOM_DATABASE_ERRORS = {
       re.compile(r"TrinoUserError"): (
           "Custom error message",
           SupersetErrorType.GENERIC_DB_ENGINE_ERROR,
           {
               "custom_doc_links": [
                   {
                       "url": "https://example.com/docs";,
                       "label": "Check documentation"
                   },
               ],
               "show_issue_info": False,
           }
       ),
   }
   ```
   
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


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