From a42f21159fe058931c95f5768ed73b1dbb119b70 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Wed, 2 Apr 2025 12:28:46 +1000 Subject: [PATCH] Use consistent exception type --- .../Authorization/OrganizationRequirementHandler.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Api/AdminConsole/Authorization/OrganizationRequirementHandler.cs b/src/Api/AdminConsole/Authorization/OrganizationRequirementHandler.cs index 01ecd6e4bd..fdcb8b2d3e 100644 --- a/src/Api/AdminConsole/Authorization/OrganizationRequirementHandler.cs +++ b/src/Api/AdminConsole/Authorization/OrganizationRequirementHandler.cs @@ -3,7 +3,6 @@ using Bit.Core.AdminConsole.Repositories; using Bit.Core.Services; using Microsoft.AspNetCore.Authorization; -using BadRequestException = Bit.Core.Exceptions.BadRequestException; namespace Bit.Api.AdminConsole.Authorization; @@ -32,7 +31,7 @@ public class OrganizationRequirementHandler( var userId = userService.GetProperUserId(httpContext.User); if (userId == null) { - throw new BadRequestException("This method should only be called on the private api with a logged in user."); + throw new InvalidOperationException("This method should only be called on the private api with a logged in user."); } Task IsProviderUserForOrg() => httpContextAccessor.HttpContext.IsProviderUserForOrgAsync(providerUserRepository, userId.Value, organizationId);