@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.
Files changed (2) hide show
  1. package/dist/index.cjs +6 -0
  2. 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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldtr/nestjs-webtransport",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "NestJS module for creating WebTransport servers and gateways.",
5
5
  "type": "module",
6
6
  "files": [