Skip to content

[skip-ci] Add missing xml docs for ExceptionHandler #48814

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

Merged
merged 5 commits into from
Jun 26, 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
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public static IServiceCollection AddExceptionHandler<TService>(this IServiceColl
}

/// <summary>
///
/// Adds an `IExceptionHandler` implementation to services. `IExceptionHandler` implementations are used by the exception handler middleware to handle unexpected request exceptions.
/// Multiple handlers can be added and they're called by the middleware in the order they're added.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="services"></param>
/// <returns></returns>

/// <typeparam name="T">The type of the exception handler implementation.</typeparam>
/// <param name="services">The <see cref="IServiceCollection"/> for adding services.</param>
/// <returns>The modified <see cref="IServiceCollection"/>.</returns>
public static IServiceCollection AddExceptionHandler<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(this IServiceCollection services) where T : class, IExceptionHandler
{
return services.AddSingleton<IExceptionHandler, T>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@
namespace Microsoft.AspNetCore.Diagnostics;

/// <summary>
///
/// Represents an interface for handling exceptions in ASP.NET Core applications.
/// `IExceptionHandler` implementations are used by the exception handler middleware.
/// </summary>
public interface IExceptionHandler
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TryHandleAsync below also needs to be filled in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that, this looks good to me. Thanks for doing it.

{
/// <summary>
///
/// Tries to handle the specified exception asynchronously within the ASP.NET Core pipeline.
/// Implementations of this method can provide custom exception handling logic for different scenarios.
/// </summary>
/// <param name="httpContext"></param>
/// <param name="exception"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <returns>
/// A <see cref="ValueTask{TResult}"/> representing the asynchronous handling operation indicating
/// <see langword="true"/> if the exception was
/// handled successfully; otherwise <see langword="false"/>.
/// </returns>
ValueTask<bool> TryHandleAsync(HttpContext httpContext, Exception exception, CancellationToken cancellationToken);
}