Merged in fix/redis-onerror (pull request #3218)

feat(BOOK-603): better logging and delete with unlinke intead of del

* feat(BOOK-603): better logging and delete with unlinke intead of del


Approved-by: Joakim Jäderberg
This commit is contained in:
Linus Flood
2025-11-26 09:36:38 +00:00
parent 250b1f2eac
commit a2d9010c8f
2 changed files with 3 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ const app = new Elysia()
set.status = 404;
return getErrorReturn(error);
case "INTERNAL_SERVER_ERROR":
default:
set.status = 500;
baseLogger.error("Internal server error", error);
Sentry.captureException(error);
@@ -59,7 +60,7 @@ app.listen(env.PORT, (server) => {
baseLogger.debug(`🦊 REDISAPI@${env.VERSION} running on ${server.url}`);
});
function getErrorReturn(error: Error) {
function getErrorReturn(error: { toString: () => string }) {
return {
status: "error",
message: error.toString(),

View File

@@ -32,7 +32,7 @@ export const cacheRoutes = new Elysia({ prefix: "/cache" })
const output = JSON.parse(value);
return { data: output };
} catch (e) {
redis.del(key);
redis.unlink(key);
cacheRouteLogger.error(`Invalid JSON in cache for '${key}'`, e);
Sentry.captureException(e, {