forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebHostExceptionCatchBlocks.cs
More file actions
84 lines (77 loc) · 4.03 KB
/
Copy pathWebHostExceptionCatchBlocks.cs
File metadata and controls
84 lines (77 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Net.Http;
using System.Web.Http.ExceptionHandling;
using System.Web.Http.Hosting;
using System.Web.Http.WebHost.Routing;
namespace System.Web.Http.WebHost
{
/// <summary>Provides the catch blocks used within this assembly.</summary>
public static class WebHostExceptionCatchBlocks
{
private static readonly ExceptionContextCatchBlock _httpControllerHandlerBufferContent =
new ExceptionContextCatchBlock(typeof(HttpControllerHandler).Name + ".BufferContent", isTopLevel: true,
callsHandler: true);
private static readonly ExceptionContextCatchBlock _httpControllerHandlerBufferError =
new ExceptionContextCatchBlock(typeof(HttpControllerHandler).Name + ".BufferError", isTopLevel: true,
callsHandler: false);
private static readonly ExceptionContextCatchBlock _httpControllerHandlerComputeContentLength =
new ExceptionContextCatchBlock(typeof(HttpControllerHandler).Name + ".ComputeContentLength",
isTopLevel: true, callsHandler: false);
private static readonly ExceptionContextCatchBlock _httpControllerHandlerStreamContent =
new ExceptionContextCatchBlock(typeof(HttpControllerHandler).Name + ".StreamContent", isTopLevel: true,
callsHandler: false);
private static readonly ExceptionContextCatchBlock _httpWebRoute =
new ExceptionContextCatchBlock(typeof(HttpWebRoute).Name, isTopLevel: true, callsHandler: true);
/// <summary>
/// Gets the label for the catch block in
/// <see cref="HttpControllerHandler"/>.WriteBufferedResponseContentAsync.
/// </summary>
/// <remarks>
/// This catch block handles exceptions when writing the <see cref="HttpContent"/> under an
/// <see cref="IHostBufferPolicySelector"/> that buffers.
/// </remarks>
public static ExceptionContextCatchBlock HttpControllerHandlerBufferContent
{
get { return _httpControllerHandlerBufferContent; }
}
/// <summary>
/// Gets the label for the catch block in <see cref="HttpControllerHandler"/>.WriteErrorResponseContentAsync.
/// </summary>
/// <remarks>
/// This catch block handles exceptions when writing the <see cref="HttpContent"/> of the error response itself
/// (after <see cref="HttpControllerHandlerBufferContent"/> or <see cref="HttpWebRoute"/>).
/// </remarks>
public static ExceptionContextCatchBlock HttpControllerHandlerBufferError
{
get { return _httpControllerHandlerBufferError; }
}
/// <summary>
/// Gets the label for the catch block in <see cref="HttpControllerHandler"/>.ComputeContentLength.
/// </summary>
/// <remarks>
/// This catch block handles exceptions when calling <see cref="HttpContent.TryComputeLength"/>.
/// </remarks>
public static ExceptionContextCatchBlock HttpControllerHandlerComputeContentLength
{
get { return _httpControllerHandlerComputeContentLength; }
}
/// <summary>
/// Gets the label for the catch block in
/// <see cref="HttpControllerHandler"/>.WriteStreamedResponseContentAsync.
/// </summary>
/// <remarks>
/// This catch block handles exceptions when writing the <see cref="HttpContent"/> under an
/// <see cref="IHostBufferPolicySelector"/> that does not buffer.
/// </remarks>
public static ExceptionContextCatchBlock HttpControllerHandlerStreamContent
{
get { return _httpControllerHandlerStreamContent; }
}
/// <summary>Gets the label for the catch block in <see cref="HttpWebRoute"/>.GetRouteData.</summary>
public static ExceptionContextCatchBlock HttpWebRoute
{
get { return _httpWebRoute; }
}
}
}