mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
feat(api): ✨ Add more Sentry logging
This commit is contained in:
parent
daba8e8178
commit
0bc6a89706
1
app.ts
1
app.ts
|
|
@ -68,6 +68,7 @@ export const appFactory = async () => {
|
||||||
redirect: "manual",
|
redirect: "manual",
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
serverLogger.error`${e}`;
|
serverLogger.error`${e}`;
|
||||||
|
sentry?.captureException(e);
|
||||||
serverLogger.error`The Frontend is not running or the route is not found: ${replacedUrl}`;
|
serverLogger.error`The Frontend is not running or the route is not found: ${replacedUrl}`;
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { errorResponse } from "@/response";
|
import { errorResponse } from "@/response";
|
||||||
|
import { sentry } from "@/sentry";
|
||||||
import { createMiddleware } from "@hono/hono/factory";
|
import { createMiddleware } from "@hono/hono/factory";
|
||||||
import { getLogger } from "@logtape/logtape";
|
import { getLogger } from "@logtape/logtape";
|
||||||
import type { SocketAddress } from "bun";
|
import type { SocketAddress } from "bun";
|
||||||
|
|
@ -25,6 +26,7 @@ export const ipBans = createMiddleware(async (context, next) => {
|
||||||
|
|
||||||
logger.error`Error while parsing banned IP "${ip}" `;
|
logger.error`Error while parsing banned IP "${ip}" `;
|
||||||
logger.error`${e}`;
|
logger.error`${e}`;
|
||||||
|
sentry?.captureException(e);
|
||||||
|
|
||||||
return errorResponse(
|
return errorResponse(
|
||||||
`A server error occured: ${(e as Error).message}`,
|
`A server error occured: ${(e as Error).message}`,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { idValidator } from "@/api";
|
import { idValidator } from "@/api";
|
||||||
import { proxyUrl } from "@/response";
|
import { proxyUrl } from "@/response";
|
||||||
import { sanitizedHtmlStrip } from "@/sanitization";
|
import { sanitizedHtmlStrip } from "@/sanitization";
|
||||||
|
import { sentry } from "@/sentry";
|
||||||
import { getLogger } from "@logtape/logtape";
|
import { getLogger } from "@logtape/logtape";
|
||||||
import type {
|
import type {
|
||||||
Attachment as ApiAttachment,
|
Attachment as ApiAttachment,
|
||||||
|
|
@ -627,6 +628,7 @@ export class Note extends BaseInterface<typeof Notes, StatusWithRelations> {
|
||||||
const resolvedEmoji = await Emoji.fetchFromRemote(emoji).catch(
|
const resolvedEmoji = await Emoji.fetchFromRemote(emoji).catch(
|
||||||
(e) => {
|
(e) => {
|
||||||
logger.error`${e}`;
|
logger.error`${e}`;
|
||||||
|
sentry?.captureException(e);
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -643,6 +645,7 @@ export class Note extends BaseInterface<typeof Notes, StatusWithRelations> {
|
||||||
attachment,
|
attachment,
|
||||||
).catch((e) => {
|
).catch((e) => {
|
||||||
logger.error`${e}`;
|
logger.error`${e}`;
|
||||||
|
sentry?.captureException(e);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { applyConfig, handleZodError, jsonOrForm } from "@/api";
|
import { applyConfig, handleZodError, jsonOrForm } from "@/api";
|
||||||
import { randomString } from "@/math";
|
import { randomString } from "@/math";
|
||||||
import { response } from "@/response";
|
import { response } from "@/response";
|
||||||
|
import { sentry } from "@/sentry";
|
||||||
import type { Hono } from "@hono/hono";
|
import type { Hono } from "@hono/hono";
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { SignJWT, jwtVerify } from "jose";
|
import { SignJWT, jwtVerify } from "jose";
|
||||||
|
|
@ -136,6 +137,7 @@ export default (app: Hono) =>
|
||||||
audience: client_id,
|
audience: client_id,
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
sentry?.captureException(e);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { applyConfig, debugRequest, handleZodError } from "@/api";
|
import { applyConfig, debugRequest, handleZodError } from "@/api";
|
||||||
import { errorResponse, jsonResponse, response } from "@/response";
|
import { errorResponse, jsonResponse, response } from "@/response";
|
||||||
|
import { sentry } from "@/sentry";
|
||||||
import type { Hono } from "@hono/hono";
|
import type { Hono } from "@hono/hono";
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { getLogger } from "@logtape/logtape";
|
import { getLogger } from "@logtape/logtape";
|
||||||
|
|
@ -183,6 +184,7 @@ export default (app: Hono) =>
|
||||||
)
|
)
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
logger.error`${e}`;
|
logger.error`${e}`;
|
||||||
|
sentry?.captureException(e);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -208,6 +210,7 @@ export default (app: Hono) =>
|
||||||
account,
|
account,
|
||||||
).catch((e) => {
|
).catch((e) => {
|
||||||
logger.error`${e}`;
|
logger.error`${e}`;
|
||||||
|
sentry?.captureException(e);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -432,6 +435,7 @@ export default (app: Hono) =>
|
||||||
return errorResponse((e as ValidationError).message, 400);
|
return errorResponse((e as ValidationError).message, 400);
|
||||||
}
|
}
|
||||||
logger.error`${e}`;
|
logger.error`${e}`;
|
||||||
|
sentry?.captureException(e);
|
||||||
return jsonResponse(
|
return jsonResponse(
|
||||||
{
|
{
|
||||||
error: "Failed to process request",
|
error: "Failed to process request",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { getLogger } from "@logtape/logtape";
|
import { getLogger } from "@logtape/logtape";
|
||||||
import { markdownParse } from "~/classes/functions/status";
|
import { markdownParse } from "~/classes/functions/status";
|
||||||
|
import { sentry } from "./sentry";
|
||||||
|
|
||||||
export const renderMarkdownInPath = async (
|
export const renderMarkdownInPath = async (
|
||||||
path: string,
|
path: string,
|
||||||
|
|
@ -15,6 +16,7 @@ export const renderMarkdownInPath = async (
|
||||||
(await markdownParse(
|
(await markdownParse(
|
||||||
(await extendedDescriptionFile.text().catch(async (e) => {
|
(await extendedDescriptionFile.text().catch(async (e) => {
|
||||||
await getLogger("server").error`${e}`;
|
await getLogger("server").error`${e}`;
|
||||||
|
sentry?.captureException(e);
|
||||||
return "";
|
return "";
|
||||||
})) ||
|
})) ||
|
||||||
defaultText ||
|
defaultText ||
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue