Describe the bug
When creating an index with bad arguments, these are passed to OpenSearch and caught by their validation, giving Marqo a 400 and the user a 500. Marqo should catch this 400 and return a 400 to the user as well. Could simply be by wrapping this in a try except block: https://github.com/marqo-ai/marqo/blob/mainline/src/marqo/tensor_search/tensor_search.py#L152
Example
mq.create_index("test-index", settings_dict={"index_defaults": {"model": "my-custom-model", "model_properties":{"dimension": "BAD DIMENSION, NOT INT"}}})
Current Output
marqo.errors.MarqoWebError: MarqoWebError: MarqoWebError Error message: {'message': "{'error': {'root_cause': [{'type': 'mapper_parsing_exception', 'reason': 'Failed to parse mapping [_doc]: Unable to parse [dimension] from provided value [wegerg] for vector [__vector_marqo_knn_field]'}], 'type': 'mapper_parsing_exception', 'reason': 'Failed to parse mapping [_doc]: Unable to parse [dimension] from provided value [wegerg] for vector [__vector_marqo_knn_field]', 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'Unable to parse [dimension] from provided value [wegerg] for vector [__vector_marqo_knn_field]'}}, 'status': 400}\nPlease create an issue on Marqo's GitHub repo (https://github.com/marqo-ai/marqo/issues) if this problem persists.", 'code': 'unhandled_backend_error', 'type': 'backend_error', 'link': ''}
status_code: 500, type: backend_error, code: unhandled_backend_error, link:
This also may be true for other OpenSearch calls (check add docs, search, etc).
Describe the bug When creating an index with bad arguments, these are passed to OpenSearch and caught by their validation, giving Marqo a 400 and the user a 500. Marqo should catch this 400 and return a 400 to the user as well. Could simply be by wrapping this in a try except block: https://github.com/marqo-ai/marqo/blob/mainline/src/marqo/tensor_search/tensor_search.py#L152
Example
Current Output
This also may be true for other OpenSearch calls (check add docs, search, etc).