From 420b3b1e695fb82bbf9bd11c936954555e5d5311 Mon Sep 17 00:00:00 2001 From: FineArchs <133759614+FineArchs@users.noreply.github.com> Date: Mon, 9 Oct 2023 04:57:12 +0900 Subject: [PATCH 1/2] descriptive error message --- packages/backend/src/server/api/endpoints/i/2fa/register.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register.ts b/packages/backend/src/server/api/endpoints/i/2fa/register.ts index b358c812eef4..e8efb8d6ed68 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register.ts @@ -54,13 +54,13 @@ export default class extends Endpoint { // eslint- if (profile.twoFactorEnabled) { if (token == null) { - throw new Error('authentication failed'); + throw new Error('authentication failed. (token is nullish)'); } try { await this.userAuthService.twoFactorAuthenticate(profile, token); } catch (e) { - throw new Error('authentication failed'); + throw new Error('authentication failed. (' + e.message + ')'); } } From 81aa7c120df039a3bf51408773bce02b9abd597d Mon Sep 17 00:00:00 2001 From: FineArchs <133759614+FineArchs@users.noreply.github.com> Date: Mon, 9 Oct 2023 05:07:18 +0900 Subject: [PATCH 2/2] Update register.ts --- packages/backend/src/server/api/endpoints/i/2fa/register.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/endpoints/i/2fa/register.ts b/packages/backend/src/server/api/endpoints/i/2fa/register.ts index e8efb8d6ed68..f31d4ea29ab5 100644 --- a/packages/backend/src/server/api/endpoints/i/2fa/register.ts +++ b/packages/backend/src/server/api/endpoints/i/2fa/register.ts @@ -60,7 +60,7 @@ export default class extends Endpoint { // eslint- try { await this.userAuthService.twoFactorAuthenticate(profile, token); } catch (e) { - throw new Error('authentication failed. (' + e.message + ')'); + throw new Error('authentication failed. (' + (e as Error).message + ')'); } }