Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧐[问题] How to handle stream errors, so that the UI can display the error? #246

Open
KrishnaPG opened this issue Jun 9, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@KrishnaPG
Copy link

🧐 问题描述

When error happens in the streamed response, the ProChat UI should display it correctly. But Iam not sure how to implement such stream.

  const readableStream = new ReadableStream({
    start(controller) { 
      getAnswer()
       .then(data => controller.enqueue(textEncoder.encode(data)))
       .catch(ex) {
          controller.error(ex); <<--- this one throws error !!
       } 
       .finally(()=> controller.close())
    }
  }

Question:
how to implement the ReadableStream correctly so that the errors are handled (and the ProChat UI shows the error).

Any help is greatly appreciated.

@ONLY-yours ONLY-yours added the documentation Improvements or additions to documentation label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants