Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove raw exception from unhandled exception event #1363

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/IdentityServer/Events/UnhandledExceptionEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public UnhandledExceptionEvent(Exception ex)
EventIds.UnhandledException,
ex.Message)
{
Exception = ex;
Details = ex.ToString();
}

Expand All @@ -34,12 +33,4 @@ public UnhandledExceptionEvent(Exception ex)
/// The details.
/// </value>
public string Details { get; set; }

/// <summary>
/// Gets or sets the exception.
/// </summary>
/// <value>
/// The exception.
/// </value>
public Exception Exception { get; set; }
}
45 changes: 45 additions & 0 deletions test/IdentityServer.UnitTests/Events/EventTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.


using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Endpoints.Results;
using Duende.IdentityServer.Models;
using Duende.IdentityServer.ResponseHandling;
using Duende.IdentityServer.Validation;
using FluentAssertions;
using IdentityModel;
using UnitTests.Common;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.WebUtilities;
using Xunit;
using Duende.IdentityServer.Services;
using Duende.IdentityServer;
using Duende.IdentityServer.Events;

namespace UnitTests.Endpoints.Results;

public class EventTests
{

[Fact]
public void UnhandledExceptionEventCanCallToString()
{
try
{
throw new InvalidOperationException("Boom");
}
catch (Exception ex)
{
var unhandledExceptionEvent = new UnhandledExceptionEvent(ex);

var s = unhandledExceptionEvent.ToString();

s.Should().NotBeNullOrEmpty();
}
}
}