The base DDSViewSet class is designed to catch these so that API clients get meaningful HTTP response codes from failed DDS operations. However, in practice, exceptions of this class are never raised and everything is transformed to a 503 with DataServiceUnavailable
In d4s2_api_v2/api.py, we have a WrappedDataServiceException class that is caught but never actually raised:
https://github.com/Duke-GCB/D4S2/blob/2f6a5f3f30bbb0f70d097c2a4d879db7c765f8a6/d4s2_api_v2/api.py#L25-L31
The base DDSViewSet class is designed to catch these so that API clients get meaningful HTTP response codes from failed DDS operations. However, in practice, exceptions of this class are never raised and everything is transformed to a 503 with
DataServiceUnavailable
https://github.com/Duke-GCB/D4S2/blob/2f6a5f3f30bbb0f70d097c2a4d879db7c765f8a6/d4s2_api_v2/api.py#L58-L67
Fix this to catch
DataServiceError
s and wrap them inWrappedDataServiceException
in a way that preserves the correct status code.