Add error handling to terminal creation
Wrap terminal creation in try-catch to prevent session creation from failing if the terminal emulator fails to initialize. The session will still work, just without ANSI processing.
This commit is contained in:
parent
58996a51f8
commit
6342c7a699
1 changed files with 10 additions and 2 deletions
|
|
@ -460,8 +460,16 @@ const server = Bun.serve<SessionData>({
|
|||
|
||||
// Create terminal emulator wide enough to avoid premature wrapping
|
||||
// Browser CSS handles responsive display; we just need ANSI processing
|
||||
const termSession = createTerminal(300, 50);
|
||||
sessionTerminals.set(session.id, termSession);
|
||||
try {
|
||||
const termSession = createTerminal(300, 50);
|
||||
sessionTerminals.set(session.id, termSession);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Failed to create terminal for session ${session.id}:`,
|
||||
error,
|
||||
);
|
||||
// Session will work but output won't be processed through terminal emulator
|
||||
}
|
||||
|
||||
console.debug(
|
||||
`Session ${session.id} started for device ${device.id}`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue