(err?: Error)
| 651 | this.activeHandlers.set(h, { start: Date.now(), name: HandlerClass.name }); |
| 652 | |
| 653 | const clean = async (err?: Error) => { |
| 654 | if (closed) return; |
| 655 | closed = true; |
| 656 | try { |
| 657 | try { |
| 658 | if (err) await h.onerror(err); |
| 659 | // FIXME: should pass type check |
| 660 | else (this.ctx.emit as any)('connection/close', h); |
| 661 | } finally { |
| 662 | h.active = false; |
| 663 | if (layer) layer.clients.delete(conn); |
| 664 | if (err && !layer) ctx.status = 500; |
| 665 | await h.cleanup?.(args); |
| 666 | } |
| 667 | } finally { |
| 668 | await sub.dispose(); |
| 669 | this.activeHandlers.delete(h); |
| 670 | } |
| 671 | }; |
| 672 | |
| 673 | try { |
| 674 | // FIXME: should pass type check |
no test coverage detected