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

Uncaught (in promise) AbortError: The user aborted a request. #91

Open
Syzblue opened this issue Dec 4, 2024 · 0 comments
Open

Uncaught (in promise) AbortError: The user aborted a request. #91

Syzblue opened this issue Dec 4, 2024 · 0 comments

Comments

@Syzblue
Copy link

Syzblue commented Dec 4, 2024

当终止链接时页面直接报错,无法catch

const abortController = new AbortController();
      fetchEventSource(`${baseServer}/polar//public/aiChat/chat`, {
        method: 'POST',
        signal: abortController.signal,
        headers: {
          'Content-Type': 'application/json; charset=UTF-8',
          user: Storage.getUid() || '',
          token: Storage.getToken() || '',
          domain: Storage.getDomain() || '',
          ticket: Storage.getTicket() || '',
          tenant: Storage.getTenant() || '',
          version: Storage.getV() || ''
        },
        body: JSON.stringify({ conversationId: conversationId, question: message }),
        async onmessage(msg) {
          // abortController.abort()
          console.log('Received:', msg.data); // 处理接收到的消息
        },
        onclose() {
          console.log("111111111111111111close")
          // abortController.abort()
        },
        onerror(err) {
          console.log(err);
          // abortController.abort()
        }
      }).then(result=>{
        console.log(result)
      }).catch(err => {
          console.error(err);
      })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant