Compare commits

...

3 Commits

Author SHA1 Message Date
Gitea Actions
695bbb61b9 ci: Bump version to 0.1.14 [skip ci] 2025-12-26 22:00:15 +05:00
877c971833 Merge branch 'main' of https://gitea.projectium.com/torbo/flyer-crawler.projectium.com
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 12m48s
2025-12-26 08:59:39 -08:00
ed3af07aab not sure why those errors got removed we'll see 2025-12-26 08:59:31 -08:00
4 changed files with 10 additions and 6 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "flyer-crawler",
"version": "0.1.13",
"version": "0.1.14",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "flyer-crawler",
"version": "0.1.13",
"version": "0.1.14",
"dependencies": {
"@bull-board/api": "^6.14.2",
"@bull-board/express": "^6.14.2",

View File

@@ -1,7 +1,7 @@
{
"name": "flyer-crawler",
"private": true,
"version": "0.1.13",
"version": "0.1.14",
"type": "module",
"scripts": {
"dev": "concurrently \"npm:start:dev\" \"vite\"",

View File

@@ -122,7 +122,7 @@ describe('errorHandler Middleware', () => {
expect.stringMatching(/Unhandled API Error \(ID: \w+\)/),
);
expect(consoleErrorSpy).toHaveBeenCalledWith(
expect.stringContaining('--- [TEST] UNHANDLED ERROR ---'),
expect.stringMatching(/--- \[TEST\] UNHANDLED ERROR \(ID: \w+\) ---/),
expect.any(Error),
);
});
@@ -229,7 +229,7 @@ describe('errorHandler Middleware', () => {
expect.stringMatching(/Unhandled API Error \(ID: \w+\)/),
);
expect(consoleErrorSpy).toHaveBeenCalledWith(
expect.stringContaining('--- [TEST] UNHANDLED ERROR ---'),
expect.stringMatching(/--- \[TEST\] UNHANDLED ERROR \(ID: \w+\) ---/),
expect.any(DatabaseError),
);
});

View File

@@ -63,7 +63,11 @@ export const errorHandler = (err: Error, req: Request, res: Response, next: Next
}
// --- Handle Generic Client Errors (e.g., from express-jwt, or manual status setting) ---
const status = (err as any).status || (err as any).statusCode;
let status = (err as any).status || (err as any).statusCode;
// Default UnauthorizedError to 401 if no status is present, a common case for express-jwt.
if (err.name === 'UnauthorizedError' && !status) {
status = 401;
}
if (status && status >= 400 && status < 500) {
log.warn({ err, statusCode: status }, `Client Error on ${req.method} ${req.path}: ${err.message}`);
return res.status(status).json({ message: err.message });