// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. namespace Microsoft.AspNet.Diagnostics { /// /// Options for the ErrorPageMiddleware /// public class ErrorPageOptions { private bool _defaultVisibility; private bool? _showExceptionDetails; private bool? _showSourceCode; private bool? _showQuery; private bool? _showCookies; private bool? _showHeaders; private bool? _showEnvironment; /// /// Create an instance with the default options settings. /// public ErrorPageOptions() { SourceCodeLineCount = 6; } /// /// Returns a new instance of ErrorPageOptions with all visibility options enabled by default. /// public static ErrorPageOptions ShowAll { get { // We don't use a static instance because it's mutable. return new ErrorPageOptions() { ShowExceptionDetails = true, ShowSourceCode = true, ShowQuery = true, ShowCookies = true, ShowHeaders = true, ShowEnvironment = true, }; } } /// /// Enables the display of exception types, messages, and stack traces. /// public bool ShowExceptionDetails { get { return _showExceptionDetails ?? _defaultVisibility; } set { _showExceptionDetails = value; } } /// /// Enabled the display of local source code around exception stack frames. /// public bool ShowSourceCode { get { return _showSourceCode ?? _defaultVisibility; } set { _showSourceCode = value; } } /// /// Determines how many lines of code to include before and after the line of code /// present in an exception's stack frame. Only applies when symbols are available and /// source code referenced by the exception stack trace is present on the server. /// public int SourceCodeLineCount { get; set; } /// /// Enables the enumeration of any parsed query values. /// public bool ShowQuery { get { return _showQuery ?? _defaultVisibility; } set { _showQuery = value; } } /// /// Enables the enumeration of any parsed request cookies. /// public bool ShowCookies { get { return _showCookies ?? _defaultVisibility; } set { _showCookies = value; } } /// /// Enables the enumeration of the request headers. /// public bool ShowHeaders { get { return _showHeaders ?? _defaultVisibility; } set { _showHeaders = value; } } /// /// Enables the enumeration of the OWIN environment values. /// public bool ShowEnvironment { get { return _showEnvironment ?? _defaultVisibility; } set { _showEnvironment = value; } } /// /// Sets the default visibility for options not otherwise specified. /// /// public void SetDefaultVisibility(bool isVisible) { _defaultVisibility = isVisible; } } }