refactor(backend): standardize error responses, logging, pagination

- errorResponse(res, error, status, publicMessage) in routeHelpers,
  wired into 125 catch blocks across 10 route files; wire format
  ({ error: <string> }) unchanged byte-for-byte
- Replace remaining console.* with logger across src (178 sites);
  3 intentional console sites kept (install boot, unbound .catch ref)
- Adopt getPagination in 6 routes where semantics match exactly
This commit is contained in:
Paul Nothaft
2026-07-03 07:49:45 +02:00
parent d44ead41c5
commit 6eb46d8c31
41 changed files with 372 additions and 482 deletions
+2 -1
View File
@@ -5,6 +5,7 @@
// Note: Requiring db here creates circular dependency
// db should be passed as parameter or required where needed
const logger = require('./logger');
/**
* Get database client type
@@ -91,7 +92,7 @@ async function getDatabaseSize(db, dbName) {
const stats = await fs.stat(dbPath);
return stats.size;
} catch (error) {
console.error('Error getting SQLite database size:', error);
logger.error('Error getting SQLite database size:', error);
return 0;
}
}