Fix TypeScript error in server.ts

- Handle error type properly in catch block
- Check if error is instanceof Error before accessing message property
- Provide fallback for unknown error types
This commit is contained in:
Peter Steinberger 2025-06-16 06:58:59 +02:00
parent 14321ccbb5
commit 74373a129d

View file

@ -594,7 +594,8 @@ app.post('/api/sessions/:sessionId/input', async (req, res) => {
} catch (error) {
console.error('Error sending input via tty-fwd:', error);
res.status(500).json({ error: 'Failed to send input', details: error.message });
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
res.status(500).json({ error: 'Failed to send input', details: errorMessage });
}
});