except TransportError as e:
if e.status_code == 400 and e.error == 'resource_already_exists_exception':
# Handle the specific exception
print("Resource already exists.")
else:
# Handle other TransportError exceptions
print(f"TransportError occurred: {e}")
so i have to write a helper that converts exceptions to semantic errors:
except TransportError as e:
return transform_exception_to_return_value(e)
*** Error: RequestError(400, 'resource_already_exists_exception', 'index [opinions/FduukSQQQcuRcp4ZK0w51g] already exists')
requires:so i have to write a helper that converts exceptions to semantic errors:
https://opensearch-project.github.io/opensearch-py/api-ref/exceptions.html#opensearchpy.TransportError
Originally posted by @rbpasker in https://github.com/opensearch-project/opensearch-py/issues/718#issuecomment-2189406536