You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/06/01 22:58:27 UTC

(superset) branch tdd/issue-33554-presto-401 created (now a05b1fc25fe)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a change to branch tdd/issue-33554-presto-401
in repository https://gitbox.apache.org/repos/asf/superset.git


      at a05b1fc25fe test(presto): 401 Unauthorized must surface as CONNECTION_ACCESS_DENIED_ERROR (#33554)

This branch includes the following new commits:

     new a05b1fc25fe test(presto): 401 Unauthorized must surface as CONNECTION_ACCESS_DENIED_ERROR (#33554)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: test(presto): 401 Unauthorized must surface as CONNECTION_ACCESS_DENIED_ERROR (#33554)

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch tdd/issue-33554-presto-401
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a05b1fc25fe92fe775deab6e07091c4b95b4251e
Author: Evan <ev...@preset.io>
AuthorDate: Mon Jun 1 15:58:02 2026 -0700

    test(presto): 401 Unauthorized must surface as CONNECTION_ACCESS_DENIED_ERROR (#33554)
    
    Regression for #33554: pyhive raises "presto error: Unexpected status
    code 401 b'Unauthorized'" when Presto rejects the connection with HTTP
    401. The current custom_errors map only matches "Access Denied: Invalid
    credentials" (LDAP path), leaving the HTTP-401 message unhandled and
    exposing a raw error to SQL Lab users.
    
    Closes #33554
    
    Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
 tests/unit_tests/db_engine_specs/test_presto.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/unit_tests/db_engine_specs/test_presto.py b/tests/unit_tests/db_engine_specs/test_presto.py
index deae004f04d..89684a11a81 100644
--- a/tests/unit_tests/db_engine_specs/test_presto.py
+++ b/tests/unit_tests/db_engine_specs/test_presto.py
@@ -386,3 +386,27 @@ def test_handle_boolean_filter() -> None:
         str(result_computed.compile(compile_kwargs={"literal_binds": True}))
         == "(expiration = 1) = true"
     )
+
+
+def test_extract_errors_maps_401_to_access_denied() -> None:
+    """
+    Regression for #33554: Presto 401 errors must surface as
+    CONNECTION_ACCESS_DENIED_ERROR rather than a raw GENERIC_DB_ENGINE_ERROR.
+
+    pyhive raises "presto error: Unexpected status code 401 b'Unauthorized'"
+    when the Presto server rejects the connection with HTTP 401. SQL Lab
+    users see a cryptic raw error instead of an actionable "check your
+    credentials" message.
+
+    The custom_errors map has a pattern for "Access Denied: Invalid
+    credentials" (PyHive LDAP auth path), but not for the HTTP 401
+    status-code message that pyhive raises when the server rejects the
+    initial request. Adding the pattern surfaces a user-readable error.
+    """
+    from superset.db_engine_specs.presto import PrestoEngineSpec
+    from superset.errors import SupersetErrorType
+
+    msg = "presto error: Unexpected status code 401 b'Unauthorized'"
+    result = PrestoEngineSpec.extract_errors(Exception(msg))
+    assert len(result) == 1
+    assert result[0].error_type == SupersetErrorType.CONNECTION_ACCESS_DENIED_ERROR