Add error messages
This commit is contained in:
parent
69573991ca
commit
e7b737a3dd
2 changed files with 3 additions and 3 deletions
|
@ -35,7 +35,7 @@ public class AdminOnlyHandler : AuthorizationHandler<AdminOnlyRequirement>
|
||||||
}
|
}
|
||||||
catch (NotFoundException _)
|
catch (NotFoundException _)
|
||||||
{
|
{
|
||||||
throw new ForbiddenException();
|
throw new ForbiddenException("You need to be logged in to do this action.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_userProfileService.IsUserProfileAdmin(userProfile))
|
if (_userProfileService.IsUserProfileAdmin(userProfile))
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class ProductTableService(ApplicationDbContext context)
|
||||||
{
|
{
|
||||||
var productTable =
|
var productTable =
|
||||||
await _context.ProductTable.FirstOrDefaultAsync(x => x.ProductTableName == productTableName) ??
|
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
|
return new ProductTableGet
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue