Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / HandleExceptionArgs.cs / 1305376 / HandleExceptionArgs.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Provides a class to provide data to the exception handling
// process.
//
//
// @owner [....]
//---------------------------------------------------------------------
namespace System.Data.Services
{
using System;
/// Use this class to customize how exceptions are handled.
public class HandleExceptionArgs
{
#region Private fields.
/// Whether the response has already been written out.
private readonly bool responseWritten;
/// The MIME type used to write the response.
private readonly string responseContentType;
/// The being handled.
private Exception exception;
/// Whether a verbose response is appropriate.
private bool useVerboseErrors;
#endregion Private fields.
#region Constructors.
/// Initalizes a new instance.
/// The being handled.
/// Whether the response has already been written out.
/// The MIME type used to write the response.
/// Whether a verbose response is appropriate.
internal HandleExceptionArgs(Exception exception, bool responseWritten, string contentType, bool verboseResponse)
{
this.exception = WebUtil.CheckArgumentNull(exception, "exception");
this.responseWritten = responseWritten;
this.responseContentType = contentType;
this.useVerboseErrors = verboseResponse;
}
#endregion Constructors.
#region Public properties.
/// Gets or sets the being handled.
/// This property may be null.
public Exception Exception
{
get { return this.exception; }
set { this.exception = value; }
}
/// Gets the content type for response.
public string ResponseContentType
{
get
{
return this.responseContentType;
}
}
/// Gets the HTTP status code for the response.
public int ResponseStatusCode
{
get
{
if (this.exception is DataServiceException)
{
return ((DataServiceException)this.exception).StatusCode;
}
else
{
return 500; // Internal Server Error.
}
}
}
/// Gets a value indicating whether the response has already been written out.
public bool ResponseWritten
{
get { return this.responseWritten; }
}
/// Gets or sets whether a verbose response is appropriate.
public bool UseVerboseErrors
{
get { return this.useVerboseErrors; }
set { this.useVerboseErrors = value; }
}
#endregion Public properties.
#region Internal properties.
/// The value for the 'Allow' response header.
internal string ResponseAllowHeader
{
get
{
if (this.exception is DataServiceException)
{
return ((DataServiceException)this.exception).ResponseAllowHeader;
}
else
{
return null;
}
}
}
#endregion Internal properties.
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HtmlLink.cs
- QuadraticBezierSegment.cs
- OleDbCommandBuilder.cs
- ResXDataNode.cs
- AttributeData.cs
- ContentControl.cs
- SchemaNamespaceManager.cs
- VisualStyleInformation.cs
- TypeResolvingOptionsAttribute.cs
- ObjectListField.cs
- ApplicationDirectory.cs
- RuntimeHandles.cs
- VerbConverter.cs
- DataGridColumnFloatingHeader.cs
- EventManager.cs
- DefaultValueAttribute.cs
- DebugHandleTracker.cs
- LowerCaseStringConverter.cs
- ColumnMapVisitor.cs
- ClientUtils.cs
- WhitespaceReader.cs
- XmlAttributeAttribute.cs
- EdgeModeValidation.cs
- ReaderOutput.cs
- VectorConverter.cs
- TextRunCache.cs
- TimeoutHelper.cs
- X509AsymmetricSecurityKey.cs
- StylusSystemGestureEventArgs.cs
- DragDropHelper.cs
- BigInt.cs
- ResourcePool.cs
- SqlDependency.cs
- WebPartActionVerb.cs
- streamingZipPartStream.cs
- TemplateAction.cs
- XmlRootAttribute.cs
- IfAction.cs
- EncodingTable.cs
- PackageRelationshipCollection.cs
- StrongNameMembershipCondition.cs
- RelationshipDetailsCollection.cs
- SapiInterop.cs
- Baml2006Reader.cs
- MeshGeometry3D.cs
- PartialClassGenerationTaskInternal.cs
- TypeSystemProvider.cs
- FunctionImportElement.cs
- XamlBrushSerializer.cs
- HttpApplicationFactory.cs
- SendActivityEventArgs.cs
- DataGridCellEditEndingEventArgs.cs
- FixedSOMPageElement.cs
- WebBrowserBase.cs
- GeometryHitTestResult.cs
- GroupItem.cs
- FixedHyperLink.cs
- PrintControllerWithStatusDialog.cs
- SafeCloseHandleCritical.cs
- MarkupWriter.cs
- EditorZone.cs
- StatusBar.cs
- DataSourceXmlTextReader.cs
- ContentTypeSettingDispatchMessageFormatter.cs
- GZipStream.cs
- FolderBrowserDialog.cs
- AngleUtil.cs
- FlowDocument.cs
- ToolBar.cs
- UInt64Converter.cs
- EndPoint.cs
- Span.cs
- odbcmetadatacollectionnames.cs
- InvalidCommandTreeException.cs
- ThreadAbortException.cs
- SqlRowUpdatedEvent.cs
- LockCookie.cs
- Camera.cs
- TemplateBaseAction.cs
- XmlUrlResolver.cs
- CompilerWrapper.cs
- CrossAppDomainChannel.cs
- HttpResponseWrapper.cs
- ShortcutKeysEditor.cs
- BufferedMessageData.cs
- HealthMonitoringSectionHelper.cs
- ContentDefinition.cs
- AttributeAction.cs
- Latin1Encoding.cs
- TextDocumentView.cs
- UmAlQuraCalendar.cs
- TextMetrics.cs
- objectquery_tresulttype.cs
- Symbol.cs
- PropertyDescriptorGridEntry.cs
- TypeElement.cs
- ResourceAssociationTypeEnd.cs
- ReadWriteObjectLock.cs
- ExpressionEditor.cs
- BitmapSizeOptions.cs