mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
feat: improve error handling in terminal settings retrieval and enhance path normalization
- Wrapped the terminal settings retrieval in a try-catch block to handle potential errors and respond with a 500 status and error details. - Updated path normalization logic to skip resolution for WSL UNC paths, preventing potential issues with path handling in Windows Subsystem for Linux. - Enhanced unit tests for session termination to include timer-based assertions for graceful session killing.
This commit is contained in:
@@ -8,14 +8,23 @@ import { getErrorMessage, logError } from "../common.js";
|
||||
|
||||
export function createSettingsGetHandler() {
|
||||
return (_req: Request, res: Response): void => {
|
||||
const terminalService = getTerminalService();
|
||||
res.json({
|
||||
success: true,
|
||||
data: {
|
||||
maxSessions: terminalService.getMaxSessions(),
|
||||
currentSessions: terminalService.getSessionCount(),
|
||||
},
|
||||
});
|
||||
try {
|
||||
const terminalService = getTerminalService();
|
||||
res.json({
|
||||
success: true,
|
||||
data: {
|
||||
maxSessions: terminalService.getMaxSessions(),
|
||||
currentSessions: terminalService.getSessionCount(),
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
logError(error, "Get terminal settings failed");
|
||||
res.status(500).json({
|
||||
success: false,
|
||||
error: "Failed to get terminal settings",
|
||||
details: getErrorMessage(error),
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user