betodealmeida commented on a change in pull request #14093:
URL: https://github.com/apache/superset/pull/14093#discussion_r613390897
##########
File path: superset/db_engine_specs/mssql.py
##########
@@ -15,15 +15,33 @@
# specific language governing permissions and limitations
# under the License.
import logging
+import re
from datetime import datetime
from typing import Any, List, Optional, Tuple
+from flask_babel import gettext as __
+
from superset.db_engine_specs.base import BaseEngineSpec, LimitMethod
+from superset.errors import SupersetErrorType
from superset.utils import core as utils
logger = logging.getLogger(__name__)
+# Regular expressions to catch custom errors
+TEST_CONNECTION_ACCESS_DENIED_REGEX = re.compile("Adaptive Server connection
failed")
+TEST_CONNECTION_INVALID_HOSTNAME_REGEX = re.compile(
+ r"Adaptive Server is unavailable or does not exist \((?P<hostname>.*?)\)"
+ "(?!.*Net-Lib error).*$"
+)
+TEST_CONNECTION_PORT_CLOSED_REGEX = re.compile(
+ r"Net-Lib error during Connection refused \(61\)"
+)
+TEST_CONNECTION_HOST_DOWN_REGEX = re.compile(
Review comment:
We can use them for both. Anytime we have a `DBAPI` exception we can
call `extract_errors` to get these errors.
--
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]