Skip to content

Commit

Permalink
allow users to see stack trace on exceptions, if they have proper per…
Browse files Browse the repository at this point in the history
…mission
  • Loading branch information
adelikat committed Feb 20, 2024
1 parent 4750b34 commit 7678e83
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion TASVideos/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Primitives;
using TASVideos.Data.Entity;

namespace TASVideos.Pages;

Expand Down Expand Up @@ -38,7 +39,7 @@ private void HandleStatusCode()

private void HandleException()
{
if (_env.IsDevelopment())
if (_env.IsDevelopment() || User.Has(PermissionTo.SeeDiagnostics))
{
var exceptionHandlerPathFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
ExceptionMessage = exceptionHandlerPathFeature?.Error.ToString() ?? "";
Expand Down

0 comments on commit 7678e83

Please sign in to comment.