[CORD-1216] If json_detail are not present in exceptions, use the deault detail field
Change-Id: I4d803775fd8ceedaa852c2a5e7d29e1919a814f2
diff --git a/xos/coreapi/apihelper.py b/xos/coreapi/apihelper.py
index 981610c..6503f12 100644
--- a/xos/coreapi/apihelper.py
+++ b/xos/coreapi/apihelper.py
@@ -27,7 +27,12 @@
context = kwargs["context"]
else:
context = args[2]
- context.set_details(e.json_detail)
+
+ if hasattr(e, 'json_detail'):
+ context.set_details(e.json_detail)
+ elif hasattr(e, 'detail'):
+ context.set_details(e.detail)
+
if (type(e) == XOSPermissionDenied):
context.set_code(grpc.StatusCode.PERMISSION_DENIED)
elif (type(e) == XOSValidationError):