fix (backend): stop sending stack traces on API errors
Co-authored-by: naskya <m@naskya.net>
This commit is contained in:
parent
e303496b5e
commit
8b3574d84c
1 changed files with 4 additions and 3 deletions
|
@ -2,6 +2,7 @@ import { performance } from "perf_hooks";
|
|||
import type Koa from "koa";
|
||||
import type { CacheableLocalUser } from "@/models/entities/user.js";
|
||||
import type { AccessToken } from "@/models/entities/access-token.js";
|
||||
import { v4 as uuid } from "uuid";
|
||||
import { getIpHash } from "@/misc/get-ip-hash.js";
|
||||
import { limiter } from "./limiter.js";
|
||||
import type { IEndpointMeta } from "./endpoints.js";
|
||||
|
@ -177,7 +178,8 @@ export default async (
|
|||
if (e instanceof ApiError) {
|
||||
throw e;
|
||||
} else {
|
||||
apiLogger.error(`Internal error occurred in ${ep.name}: ${e.message}`, {
|
||||
const errorId = uuid();
|
||||
apiLogger.error(`Internal error occurred in ${ep.name}: ${e.message} (Event ID: ${errorId})`, {
|
||||
ep: ep.name,
|
||||
ps: data,
|
||||
e: {
|
||||
|
@ -188,9 +190,8 @@ export default async (
|
|||
});
|
||||
throw new ApiError(null, {
|
||||
e: {
|
||||
message: e.message,
|
||||
message: `Internal error (Event ID: ${errorId})`,
|
||||
code: e.name,
|
||||
stack: e.stack,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue