// 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 { /// Provides the catch blocks used within this assembly. 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); /// Gets the catch block in .BufferContent. /// /// This catch block handles exceptions when writing the under an /// that buffers. /// public static ExceptionContextCatchBlock HttpMessageHandlerAdapterBufferContent { get { return _httpMessageHandlerAdapterBufferContent; } } /// Gets the catch block in .BufferError. /// /// This catch block handles exceptions when writing the of the error response itself /// (after ). /// public static ExceptionContextCatchBlock HttpMessageHandlerAdapterBufferError { get { return _httpMessageHandlerAdapterBufferError; } } /// Gets the catch block in .ComputeContentLength. /// /// This catch block handles exceptions when calling . /// public static ExceptionContextCatchBlock HttpMessageHandlerAdapterComputeContentLength { get { return _httpMessageHandlerAdapterComputeContentLength; } } /// Gets the catch block in .StreamContent. /// /// This catch block handles exceptions when writing the under an /// that does not buffer. /// public static ExceptionContextCatchBlock HttpMessageHandlerAdapterStreamContent { get { return _httpMessageHandlerAdapterStreamContent; } } } }