mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
reduce log spam from ApiCallService
This commit is contained in:
parent
22653efdc4
commit
d3d201d0cf
1 changed files with 10 additions and 8 deletions
|
@ -27,6 +27,7 @@ import { AuthenticateService, AuthenticationError } from './AuthenticateService.
|
|||
import type { FastifyRequest, FastifyReply } from 'fastify';
|
||||
import type { OnApplicationShutdown } from '@nestjs/common';
|
||||
import type { IEndpointMeta, IEndpoint } from './endpoints.js';
|
||||
import { renderFullError } from '@/misc/render-full-error.js';
|
||||
|
||||
const accessDenied = {
|
||||
message: 'Access denied.',
|
||||
|
@ -101,15 +102,16 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
throw err;
|
||||
} else {
|
||||
const errId = randomUUID();
|
||||
this.logger.error(`Internal error occurred in ${ep.name}: ${renderInlineError(err)}`, {
|
||||
ep: ep.name,
|
||||
const fullError = renderFullError(err);
|
||||
const message = typeof(fullError) === 'string'
|
||||
? `Internal error id=${errId} occurred in ${ep.name}: ${fullError}`
|
||||
: `Internal error id=${errId} occurred in ${ep.name}:`;
|
||||
const data = typeof(fullError) === 'object'
|
||||
? { e: fullError }
|
||||
: {};
|
||||
this.logger.error(message, {
|
||||
user: userId ?? '<unauthenticated>',
|
||||
e: {
|
||||
message: err.message,
|
||||
code: err.name,
|
||||
stack: err.stack,
|
||||
id: errId,
|
||||
},
|
||||
...data,
|
||||
});
|
||||
|
||||
if (this.config.sentryForBackend) {
|
||||
|
|
Loading…
Add table
Reference in a new issue