kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
fix: handle abort reason correctly
rodzic
f823da15af
commit
9d2eef94e5
|
@ -267,7 +267,12 @@ export class TwilioConversationClient {
|
|||
do {
|
||||
if (aborted) {
|
||||
await this.deleteConversation(conversationSid)
|
||||
throw new Error('Aborted waiting for reply')
|
||||
const reason = stopSignal?.reason || 'Aborted waiting for reply'
|
||||
if (reason instanceof Error) {
|
||||
throw reason
|
||||
} else {
|
||||
throw new Error(reason)
|
||||
}
|
||||
}
|
||||
const response = await this.fetchMessages(conversationSid)
|
||||
if (response.messages.length > 1) {
|
||||
|
|
|
@ -127,12 +127,12 @@ test('TwilioConversationClient.sendAndWaitForReply.stopSignal', async (t) => {
|
|||
intervalMs: 5000, // 5 seconds
|
||||
stopSignal: controller.signal
|
||||
})
|
||||
controller.abort()
|
||||
controller.abort('Aborted')
|
||||
return promise
|
||||
},
|
||||
{
|
||||
instanceOf: Error,
|
||||
message: 'Aborted waiting for reply'
|
||||
message: 'Aborted'
|
||||
}
|
||||
)
|
||||
})
|
||||
|
|
Ładowanie…
Reference in New Issue