Skip to content

Commit

Permalink
Merge pull request #126 from mindsdb/create-mind-error-catch
Browse files Browse the repository at this point in the history
Better exception handling for 'create mind'
  • Loading branch information
StpMax authored Jun 25, 2024
2 parents 98094d7 + 2d09aa9 commit d1fbab7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mindsdb_sdk/utils/mind.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ def create_mind(
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status()
except requests.exceptions.HTTPError as e:
logger.error(f"Failed to create mind: {e.response.json()}")
try:
error_message = e.response.json()
except Exception:
error_message = str(e)
logger.error(f"Failed to create mind: {error_message}")
raise e
except Exception as e:
logger.error(f"Failed to create mind: {e}")
raise e

name = response.json()['name']
Expand Down

0 comments on commit d1fbab7

Please sign in to comment.