1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Narrow LoggerArgs types and fix bad revert

This commit is contained in:
sarayourfriend 2024-03-31 09:40:25 +11:00
parent 2b26b3744b
commit 409af3898b
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View File

@ -11,8 +11,7 @@ if (forcedDebug === true) {
);
}
// Match `console.log` inputs
export type LoggerArgs = Parameters<Console["log"]>[0]
export type LoggerArgs = (string | number | (() => string) | Record<any, unknown> | Error);
export type LoggerFunction = (...args: LoggerArgs[]) => void;
export interface ILogger {

View File

@ -132,11 +132,12 @@ export class RenderingMWs {
): void {
if (err instanceof ErrorDTO) {
if (err.details) {
const logFn = Logger.logLevelForError(err.code)
LoggerRouter.log(logFn, req, res);
// use separate rendering for detailsStr
const d = err.detailsStr;
delete err.detailsStr;
console.log(err);
logFn(err);
err.detailsStr = d;
delete err.details; // do not send back error object to the client side