@ldtr/nestjs-webtransport 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,10 @@ async function* generateUStream(session) {
|
|
|
50
50
|
reader.releaseLock();
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
function isSessionClosedNormally(error) {
|
|
54
|
+
if (!(error instanceof Error)) return false;
|
|
55
|
+
return error.name === "WebTransportError" && /session closed/i.test(error.message) && /code 0/i.test(error.message);
|
|
56
|
+
}
|
|
53
57
|
async function* generateChunks(reader) {
|
|
54
58
|
try {
|
|
55
59
|
while (true) {
|
|
@@ -57,6 +61,8 @@ async function* generateChunks(reader) {
|
|
|
57
61
|
if (done) break;
|
|
58
62
|
yield value;
|
|
59
63
|
}
|
|
64
|
+
} catch (error) {
|
|
65
|
+
if (!isSessionClosedNormally(error)) throw error;
|
|
60
66
|
} finally {
|
|
61
67
|
reader.releaseLock();
|
|
62
68
|
}
|