Skip to content

Commit abcf53c

Browse files
committed
feat: provide error context when creating mind
1 parent 61b75cb commit abcf53c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

mindsdb_sdk/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__title__ = 'mindsdb_sdk'
22
__package_name__ = 'mindsdb_sdk'
3-
__version__ = '2.4.1'
3+
__version__ = '2.4.2'
44
__description__ = "MindsDB Python SDK, provides an SDK to use a remote mindsdb instance"
55
__email__ = "[email protected]"
66
__author__ = 'MindsDB Inc'

mindsdb_sdk/utils/mind.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import requests
2+
from logging import getLogger
3+
4+
logger = getLogger(__name__)
25

36

47
# Define the Mind entity
@@ -46,8 +49,12 @@ def create_mind(
4649
"data_source_type": data_source_type,
4750
"data_source_connection_args": data_source_connection_args
4851
}
49-
response = requests.post(url, json=payload, headers=headers)
50-
response.raise_for_status()
52+
try:
53+
response = requests.post(url, json=payload, headers=headers)
54+
response.raise_for_status()
55+
except requests.exceptions.HTTPError as e:
56+
logger.error(f"Failed to create mind: {e.response.json()}")
57+
raise e
5158

5259
name = response.json()['name']
5360

0 commit comments

Comments
 (0)