From 0ce08bf00aa5a111407029aee76abfcb6fa18901 Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Fri, 19 Mar 2021 12:21:42 +0200 Subject: [PATCH] actually throw errors --- app/plus/service.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/plus/service.ts b/app/plus/service.ts index f8169ae3b..a11eaa0bc 100644 --- a/app/plus/service.ts +++ b/app/plus/service.ts @@ -292,7 +292,7 @@ const addSuggestion = async ({ isResuggestion === false && suggesterId === userId ); if (usersSuggestion) { - httpError.badRequest("already made a new suggestion"); + throw httpError.badRequest("already made a new suggestion"); } } @@ -305,7 +305,7 @@ const addSuggestion = async ({ !suggesterPlusStatus.membershipTier || suggesterPlusStatus.membershipTier > input.tier ) { - httpError.badRequest( + throw httpError.badRequest( "not a member of high enough tier to suggest for this tier" ); } @@ -315,7 +315,7 @@ const addSuggestion = async ({ } if (getVotingRange().isHappening) { - httpError.badRequest("voting has already started"); + throw httpError.badRequest("voting has already started"); } return prisma.$transaction([ @@ -359,17 +359,17 @@ const addVouch = async ({ ); if ((suggesterPlusStatus?.canVouchFor ?? Infinity) > input.tier) { - httpError.badRequest( + throw httpError.badRequest( "not a member of high enough tier to vouch for this tier" ); } if (vouchedUserAlreadyHasAccess()) { - httpError.badRequest("vouched user already has access"); + throw httpError.badRequest("vouched user already has access"); } if (getVotingRange().isHappening) { - httpError.badRequest("voting has already started"); + throw httpError.badRequest("voting has already started"); } return prisma.$transaction([