Skip to content

Commit d5019a5

Browse files
authored
🐛 models: Fix crash on api error (#137)
* 🐛 models: Fix crash on api error * 🐛 tests: Increase test timeout
1 parent 4c5b07e commit d5019a5

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

lib/generate.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,11 @@ function stream(
366366
ws.onopen = () => ws.send(JSON.stringify(requestBody));
367367
ws.onmessage = (data: unknown) => onMessage(data, resultStream);
368368
ws.onclose = () => resultStream.push(null);
369+
ws.onerror = () => resultStream.push(null);
369370
resultStream.stop = () => {
370371
ws.send("STOP");
371372
};
372-
})();
373+
})().catch(console.error);
373374
return resultStream;
374375
}
375376

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "polyfire-js",
3-
"version": "0.2.58",
3+
"version": "0.2.59",
44
"main": "index.js",
55
"types": "index.d.ts",
66
"author": "Lancelot Owczarczak <[email protected]>",

tests/generation.test.js

+1
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,5 @@ test(
9696

9797
expect(message).toBe("banana42");
9898
}),
99+
10000,
99100
);

0 commit comments

Comments
 (0)