diff --git a/DrinkRateAPI/AuthorizationPolicies/AdminOnlyRequirement.cs b/DrinkRateAPI/AuthorizationPolicies/AdminOnlyRequirement.cs index c6d18a2..384290e 100644 --- a/DrinkRateAPI/AuthorizationPolicies/AdminOnlyRequirement.cs +++ b/DrinkRateAPI/AuthorizationPolicies/AdminOnlyRequirement.cs @@ -35,7 +35,7 @@ public class AdminOnlyHandler : AuthorizationHandler } catch (NotFoundException _) { - throw new ForbiddenException(); + throw new ForbiddenException("You need to be logged in to do this action."); } if (_userProfileService.IsUserProfileAdmin(userProfile)) diff --git a/DrinkRateAPI/Services/ProductTableService.cs b/DrinkRateAPI/Services/ProductTableService.cs index c10506f..e05d83b 100644 --- a/DrinkRateAPI/Services/ProductTableService.cs +++ b/DrinkRateAPI/Services/ProductTableService.cs @@ -15,8 +15,8 @@ public class ProductTableService(ApplicationDbContext context) { var productTable = await _context.ProductTable.FirstOrDefaultAsync(x => x.ProductTableName == productTableName) ?? - throw new NotFoundException(); - + throw new NotFoundException($"Product table with the name {productTableName} not found."); + return new ProductTableGet { ProductTableName = productTable.ProductTableName,