Skip to content

Commit f790a49

Browse files
fix: BI-0 more accurate exception for invalid conn_type in forms (#1060)
1 parent 7321197 commit f790a49

File tree

1 file changed

+7
-5
lines changed
  • lib/dl_api_lib/dl_api_lib/app/control_api/resources

1 file changed

+7
-5
lines changed

lib/dl_api_lib/dl_api_lib/app/control_api/resources/info.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
get_connection_form_factory_cls,
1515
)
1616
from dl_api_lib.enums import BI_TYPE_AGGREGATIONS
17-
from dl_api_lib.exc import UnsupportedForEntityType
17+
from dl_api_lib.exc import (
18+
BadConnectionType,
19+
UnsupportedForEntityType,
20+
)
1821
from dl_api_lib.public.entity_usage_checker import PublicEnvEntityUsageChecker
1922
from dl_api_lib.schemas.main import BadRequestResponseSchema
2023
from dl_constants.enums import (
@@ -185,10 +188,9 @@ class ConnectorForm(BIResource):
185188
},
186189
)
187190
def get(self, conn_type: str, form_mode: str) -> dict:
188-
try:
189-
ct = ConnectionType(conn_type)
190-
except ValueError:
191-
raise UnsupportedForEntityType(f"Unknown connector type: {conn_type}") from None
191+
if not conn_type or conn_type not in ConnectionType:
192+
raise BadConnectionType(f"Not a valid connection type for this environment: {conn_type}")
193+
ct = ConnectionType(conn_type)
192194

193195
try:
194196
mode = ConnectionFormMode(form_mode)

0 commit comments

Comments
 (0)