diff --git a/caikit_nlp/toolkit/text_generation/tgis_utils.py b/caikit_nlp/toolkit/text_generation/tgis_utils.py index beb7e7a7..d8988ce7 100644 --- a/caikit_nlp/toolkit/text_generation/tgis_utils.py +++ b/caikit_nlp/toolkit/text_generation/tgis_utils.py @@ -476,13 +476,16 @@ def unary_generate( request, timeout=self.tgis_req_timeout ) except grpc._channel._InactiveRpcError as err: - log.error("", err.details) + details = err.details() + log.error("", details) caikit_status_code = GRPC_TO_CAIKIT_CORE_STATUS.get( err.code(), CaikitCoreStatusCode.UNKNOWN ) - raise CaikitCoreException( - caikit_status_code, INACTIVE_RPC_CONN_ERR_MESSAGE - ) from err + if caikit_status_code == CaikitCoreStatusCode.CONNECTION_ERROR: + raise CaikitCoreException( + caikit_status_code, INACTIVE_RPC_CONN_ERR_MESSAGE + ) from err + raise CaikitCoreException(caikit_status_code, details) from err except grpc.RpcError as err: raise_caikit_core_exception(err) @@ -663,13 +666,16 @@ def stream_generate( details=details, ) except grpc._channel._InactiveRpcError as err: - log.error("", err.details) + details = err.details() + log.error("", details) caikit_status_code = GRPC_TO_CAIKIT_CORE_STATUS.get( err.code(), CaikitCoreStatusCode.UNKNOWN ) - raise CaikitCoreException( - caikit_status_code, INACTIVE_RPC_CONN_ERR_MESSAGE - ) from err + if caikit_status_code == CaikitCoreStatusCode.CONNECTION_ERROR: + raise CaikitCoreException( + caikit_status_code, INACTIVE_RPC_CONN_ERR_MESSAGE + ) from err + raise CaikitCoreException(caikit_status_code, details) from err except grpc.RpcError as err: raise_caikit_core_exception(err)