mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
refactor: centralize error handling utilities across route modules
- Introduced a new common utility module for error handling, providing consistent methods for retrieving error messages and logging errors. - Updated individual route modules to utilize the shared error handling functions, reducing code duplication and improving maintainability. - Ensured all routes now log errors in a standardized format, enhancing debugging and monitoring capabilities.
This commit is contained in:
@@ -31,10 +31,11 @@ export function createResolveDirectoryHandler() {
|
||||
const stats = await fs.stat(resolvedPath);
|
||||
if (stats.isDirectory()) {
|
||||
addAllowedPath(resolvedPath);
|
||||
return res.json({
|
||||
res.json({
|
||||
success: true,
|
||||
path: resolvedPath,
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
// Not a valid absolute path, continue to search
|
||||
@@ -102,10 +103,11 @@ export function createResolveDirectoryHandler() {
|
||||
|
||||
// Found matching directory
|
||||
addAllowedPath(candidatePath);
|
||||
return res.json({
|
||||
res.json({
|
||||
success: true,
|
||||
path: candidatePath,
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
// Directory doesn't exist at this location, continue searching
|
||||
|
||||
Reference in New Issue
Block a user