mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: nolog property support for error instance
This commit is contained in:
1 parent
25741ac300
commit
66dff28330
1 file changed
+1
-1
@@ -199,7 +199,7 @@ export class Handler extends HandlerCommon {
|
||||
async onerror(error: HydroError) {
|
||||
error.msg ||= () => error.message;
|
||||
if (error instanceof UserFacingError && !process.env.DEV) error.stack = '';
|
||||
if (!(error instanceof NotFoundError)) {
|
||||
if (!(error instanceof NotFoundError) && !('nolog' in error)) {
|
||||
// eslint-disable-next-line max-len
|
||||
logger.error(`User: ${this.user._id}(${this.user.uname}) ${this.request.method}: /d/${this.domain._id}${this.request.path}`, error.msg(), error.params);
|
||||
if (error.stack) logger.error(error.stack);
|
||||
|
||||
Reference in new issue
Block a user