src/packages/EmbedIO/ExceptionHandler.cs
/// <summary>
/// <para>Sends an empty <c>500 Internal Server Error</c> response,
/// with the following additional headers:</para>
/// <list type="table">
///   <listheader>
///     <term>Header</term>
///     <description>Value</description>
///   </listheader>
///   <item>
///     <term><c>X-Exception-Type</c></term>
///     <description>The name (without namespace) of the type of exception that was thrown.</description>
///   </item>
///   <item>
///     <term><c>X-Exception-Message</c></term>
///     <description>The <see cref="Exception.Message">Message</see> property of the exception.</description>
///   </item>
/// </list>
/// <para>The aforementioned header names are available as the <see cref="ExceptionTypeHeaderName"/> and
/// <see cref="ExceptionMessageHeaderName"/> properties, respectively.</para>
/// </summary>
/// <param name="context">An <see cref="IHttpContext"/> interface representing the context of the request.</param>
/// <param name="exception">The unhandled exception.</param>
/// <exception cref="ArgumentNullException">
/// <para><paramref name="context"/> is <see langword="null"/>.</para>
/// <para>- or -</para>
/// <para><paramref name="exception"/> is <see langword="null"/>.</para>
/// </exception>
/// <returns>A <see cref="Task"/> representing the ongoing operation.</returns>
Sends an empty 500 Internal Server Error



X-Exception-TypeThe name (without namespace) of the type of exception that was thrown.

X-Exception-MessageThe
MessageThe aforementioned header names are available as the  and
properties, respectively.
Sends an empty 500 Internal Server Error X - Exception - TypeThe name ( without namespace ) of the type of exception that was thrown . X - Exception - MessageThe MessageThe aforementioned header names are available as the and properties respectively .
public static Task EmptyResponseWithHeaders(IHttpContext context, Exception exception)
        {
            Validate.NotNull(nameof(context), context);
            Validate.NotNull(nameof(exception), exception);
            context.Response.Headers[ExceptionTypeHeaderName] = Uri.EscapeDataString(exception.GetType().Name);
            context.Response.Headers[ExceptionMessageHeaderName] = Uri.EscapeDataString(exception.Message);
            context.Response.SetEmptyResponse((int)HttpStatusCode.InternalServerError);
            return Task.CompletedTask;
        }
public static Task EmptyResponseWithHeaders ( IHttpContext context , Exception exception ) { Validate . NotNull ( nameof ( context ) , context ) ; Validate . NotNull ( nameof ( exception ) , exception ) ; context . Response . Headers [ ExceptionTypeHeaderName ] = Uri . EscapeDataString ( exception . GetType ( ) . Name ) ; context . Response . Headers [ ExceptionMessageHeaderName ] = Uri . EscapeDataString ( exception . Message ) ; context . Response . SetEmptyResponse ( ( int ) HttpStatusCode . InternalServerError ) ; return Task . CompletedTask ; }
Sends an empty 500 Internal Server Error
Sends an empty 500 Internal Server Error
A  representing the ongoing operation.
A representing the ongoing operation .
None
context
IHttpContext
An  interface representing the context of the request.
An interface representing the context of the request .
exception
Exception
The unhandled exception.
The unhandled exception .