matrix-public-archive/server/lib/errors
Eric Eastwood 9078abf4f1
Timeout requests and stop processing further (#204)
Fix https://github.com/matrix-org/matrix-public-archive/issues/148
Fix https://github.com/matrix-org/matrix-public-archive/issues/40

 - Apply timeout middleware to all room directory and room routes
 - Stop messing with the response after we timeout. Fix https://github.com/matrix-org/matrix-public-archive/issues/148
    - This also involves cancelling any `async/await` things like requests in the routes so we throw an abort error instead of continuing on. Fix https://github.com/matrix-org/matrix-public-archive/issues/40
 - Also abort the route if we see that the user closed the request before we could respond to them
 - Bumps minimum supported Node.js version to v18 because we're now using the built-in native `fetch` in Node.js vs `node-fetch`. This gives us the custom `signal.reason` that we aborted with instead of a generic `AbortError`.
    - This also means we had to add some instrumentation for `fetch` which uses `undici` under the hood. Settled on some unofficial instrumentation: [`opentelemetry-instrumentation-fetch-node`](https://www.npmjs.com/package/opentelemetry-instrumentation-fetch-node)
2023-05-02 00:39:01 -05:00
..
extended-error.js Timeout requests and stop processing further (#204) 2023-05-02 00:39:01 -05:00
rethrown-error.js Timeout requests and stop processing further (#204) 2023-05-02 00:39:01 -05:00
route-timeout-abort-error.js Timeout requests and stop processing further (#204) 2023-05-02 00:39:01 -05:00
status-error.js Timeout requests and stop processing further (#204) 2023-05-02 00:39:01 -05:00
user-closed-connection-abort-error.js Timeout requests and stop processing further (#204) 2023-05-02 00:39:01 -05:00