Skip to content

Commit

Permalink
🥅 Catch InactiveError for TGIS to modify error message
Browse files Browse the repository at this point in the history
Signed-off-by: gkumbhat <kumbhat.gaurav@gmail.com>
  • Loading branch information
gkumbhat committed Aug 2, 2024
1 parent 1e5aac6 commit 23dc8e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions caikit_nlp/toolkit/text_generation/tgis_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ def unary_generate(
batch_response = self.tgis_client.Generate(
request, timeout=self.tgis_req_timeout
)
except grpc._channel._InactiveRpcError as err:
log.error("<NLP30829218E>", str(err))
error_message = "The underlying TCP connection is closed"
raise CaikitCoreException(CaikitCoreStatusCode.INTERNAL, error_message)
except grpc.RpcError as err:
raise_caikit_core_exception(err)

Expand Down Expand Up @@ -653,6 +657,10 @@ def stream_generate(
input_tokens=input_token_list,
details=details,
)
except grpc._channel._InactiveRpcError as err:
log.error("<NLP11829118E>", str(err))
error_message = "The underlying TCP connection is closed"
raise CaikitCoreException(CaikitCoreStatusCode.INTERNAL, error_message)
except grpc.RpcError as err:
raise_caikit_core_exception(err)

Expand Down

0 comments on commit 23dc8e6

Please sign in to comment.