Return exception message back to client #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Currently, if an exception occurs for a request, the server does not respond back to the client, causing the client to wait for the response back without ever receiving anything.
Fix
I have created a new function, handle_exception, which can be invoked in the catch part of a try-catch block. This function does the following:
prompt_ids2jobs
andprompt_length
dictionaries, if they exist.Result
This ensures that the client receives the exception message in the form of a response.
Note: Since this PR is created on top of PR #21, it also addresses Issue #18. Therefore, I will close PR #21 as this PR covers the code changes included there as well.