From 40bab08529ffc1430c8b84cbf12cf580e8df5cf4 Mon Sep 17 00:00:00 2001 From: Tsuyumi <40047364+SnowAgar25@users.noreply.github.com> Date: Thu, 7 Nov 2024 01:55:12 +0800 Subject: [PATCH] feat: better error message display (#17477) --- lib/middleware/access-control.ts | 6 +++--- lib/views/error.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/middleware/access-control.ts b/lib/middleware/access-control.ts index dade5f26608cac..41123b1f84527a 100644 --- a/lib/middleware/access-control.ts +++ b/lib/middleware/access-control.ts @@ -3,8 +3,8 @@ import { config } from '@/config'; import md5 from '@/utils/md5'; import RejectError from '@/errors/types/reject'; -const reject = () => { - throw new RejectError('Authentication failed. Access denied.'); +const reject = (requestPath) => { + throw new RejectError(`Authentication failed. Access denied.\n${requestPath}`); }; const middleware: MiddlewareHandler = async (ctx, next) => { @@ -16,7 +16,7 @@ const middleware: MiddlewareHandler = async (ctx, next) => { await next(); } else { if (config.accessKey && !(config.accessKey === accessKey || accessCode === md5(requestPath + config.accessKey))) { - return reject(); + return reject(requestPath); } await next(); } diff --git a/lib/views/error.tsx b/lib/views/error.tsx index 5277358be57611..f24e9b27d8446d 100644 --- a/lib/views/error.tsx +++ b/lib/views/error.tsx @@ -26,7 +26,7 @@ const Index: FC<{
Error Message:
- {message}
+ {message}
Route: {errorRoute}