Skip to content

Commit ceeca1e

Browse files
committed
fix uncaught exception when closing terminal session
1 parent 2b61b51 commit ceeca1e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/packages/frontend/frame-editors/terminal-editor/nats-terminal-connection.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,19 @@ export class NatsTerminalConnection extends EventEmitter {
154154
}
155155
};
156156

157-
close = () => {
157+
close = async () => {
158158
webapp_client.nats_client.removeListener("connected", this.clearWriteQueue);
159159
this.stream?.close();
160160
delete this.stream;
161161
this.service?.close();
162162
delete this.service;
163-
this.api.close(webapp_client.browser_id);
164163
this.setState("closed");
164+
try {
165+
await this.api.close(webapp_client.browser_id);
166+
} catch {
167+
// we did our best to quickly tell that we're closed, but if it times out or fails,
168+
// it is the responsibility of the project to stop worrying about this browser.
169+
}
165170
};
166171

167172
end = () => {

0 commit comments

Comments
 (0)