betodealmeida opened a new pull request #13601:
URL: https://github.com/apache/superset/pull/13601


   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   When connecting to a database fails, do some diagnostics to present better 
messages to the user.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   N/A
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   
   Resposne from invalid hostname 
(`postgres://username:password@host:12345/db`):
   
   ```json
   {
        "errors": [
                {
                        "message": "Unable to resolve hostname \"host\".",
                        "error_type": "TEST_CONNECTION_INVALID_HOSTNAME_ERROR",
                        "level": "error",
                        "extra": {
                                "hostname": "host",
                                "issue_codes": [
                                        {
                                                "code": 1007,
                                                "message": "Issue 1007 - The 
hostname provided can't be resolved."
                                        }
                                ]
                        }
                }
        ]
   }
   ```
   
   Response from valid hostname, with host up but port closed 
(`postgres://username:password@localhost:12345/db`):
   
   ```json
   {
        "errors": [
                {
                        "message": "The host localhost is up, but the port 
12345 is closed.",
                        "error_type": "TEST_CONNECTION_PORT_CLOSED_ERROR",
                        "level": "error",
                        "extra": {
                                "hostname": "localhost",
                                "port": 12345,
                                "issue_codes": [
                                        {
                                                "code": 1008,
                                                "message": "Issue 1008 - The 
port is closed."
                                        }
                                ]
                        }
                }
        ]
   }
   ```
   
   Response from valid hostname, but host is down 
(`postgres://username:[email protected]:12345/db`):
   
   ```json
   {
        "errors": [
                {
                        "message": "The host pub.dealmeida.net might be down, 
ond can't be reached on port 12345.",
                        "error_type": "TEST_CONNECTION_HOST_DOWN_ERROR",
                        "level": "error",
                        "extra": {
                                "hostname": "pub.dealmeida.net",
                                "port": 12345,
                                "issue_codes": [
                                        {
                                                "code": 1009,
                                                "message": "Issue 1009 - The 
host might be down, and can't be reached on the provided port."
                                        }
                                ]
                        }
                }
        ]
   }
   ```
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Changes UI
   - [ ] Requires DB Migration.
   - [ ] Confirm DB Migration upgrade and downgrade tested.
   - [ ] 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.

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