forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOwinExceptionCatchBlocks.cs
More file actions
77 lines (71 loc) · 3.54 KB
/
OwinExceptionCatchBlocks.cs
File metadata and controls
77 lines (71 loc) · 3.54 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
// 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;
namespace System.Web.Http.Owin
{
/// <summary>Provides the catch blocks used within this assembly.</summary>
public static class OwinExceptionCatchBlocks
{
private static readonly ExceptionContextCatchBlock _httpMessageHandlerAdapterBufferContent =
new ExceptionContextCatchBlock(typeof(HttpMessageHandlerAdapter).Name + ".BufferContent",
isTopLevel: true, callsHandler: true);
private static readonly ExceptionContextCatchBlock _httpMessageHandlerAdapterBufferError =
new ExceptionContextCatchBlock(typeof(HttpMessageHandlerAdapter).Name + ".BufferError", isTopLevel: true,
callsHandler: false);
private static readonly ExceptionContextCatchBlock _httpMessageHandlerAdapterComputeContentLength =
new ExceptionContextCatchBlock(typeof(HttpMessageHandlerAdapter).Name + ".ComputeContentLength",
isTopLevel: true, callsHandler: false);
private static readonly ExceptionContextCatchBlock _httpMessageHandlerAdapterStreamContent =
new ExceptionContextCatchBlock(typeof(HttpMessageHandlerAdapter).Name + ".StreamContent",
isTopLevel: true, callsHandler: false);
/// <summary>Gets the catch block in <see cref="HttpMessageHandlerAdapter"/>.BufferContent.</summary>
/// <remarks>
/// This catch block handles exceptions when writing the <see cref="HttpContent"/> under an
/// <see cref="IHostBufferPolicySelector"/> that buffers.
/// </remarks>
public static ExceptionContextCatchBlock HttpMessageHandlerAdapterBufferContent
{
get
{
return _httpMessageHandlerAdapterBufferContent;
}
}
/// <summary>Gets the catch block in <see cref="HttpMessageHandlerAdapter"/>.BufferError.</summary>
/// <remarks>
/// This catch block handles exceptions when writing the <see cref="HttpContent"/> of the error response itself
/// (after <see cref="HttpMessageHandlerAdapterBufferContent"/>).
/// </remarks>
public static ExceptionContextCatchBlock HttpMessageHandlerAdapterBufferError
{
get
{
return _httpMessageHandlerAdapterBufferError;
}
}
/// <summary>Gets the catch block in <see cref="HttpMessageHandlerAdapter"/>.ComputeContentLength.</summary>
/// <remarks>
/// This catch block handles exceptions when calling <see cref="HttpContent.TryComputeLength"/>.
/// </remarks>
public static ExceptionContextCatchBlock HttpMessageHandlerAdapterComputeContentLength
{
get
{
return _httpMessageHandlerAdapterComputeContentLength;
}
}
/// <summary>Gets the catch block in <see cref="HttpMessageHandlerAdapter"/>.StreamContent.</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 HttpMessageHandlerAdapterStreamContent
{
get
{
return _httpMessageHandlerAdapterStreamContent;
}
}
}
}