examples icon indicating copy to clipboard operation
examples copied to clipboard

ai-chatgpt example server does not handle cancellation without throwing an error

Open pkellner opened this issue 2 years ago • 0 comments

I've create a repo for just the code that is in the example described here and in the location here.

I've copied those files into this repo and made just a few changes to chat.tsx to enable cancelling the stream being generated from ChatGPT.

It works as expected (when press the "Stop Streaming" new button, the generation of the answer stops as expected. However, the server throws an error that is not caught which is undesirable. IMHO, the server should not be creating uncaught errors and throwing them which is why I'm reporting this as an issue.

Below is the error the server creates on streaming being stopped, as well as the error code thrown.

- error uncaughtException: Error: aborted
    at connResetException (node:internal/errors:717:14)
    at abortIncoming (node:_http_server:754:17)
    at socketOnClose (node:_http_server:748:3)
    at Socket.emit (node:events:525:35)
    at TCP.<anonymous> (node:net:322:12) {
  digest: undefined

image

pkellner avatar Jul 23 '23 19:07 pkellner