Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWeb / Server / System / Data / Services / HandleExceptionArgs.cs / 1 / 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.
//----------------------------------------------------------------------
//
// 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
- ScriptMethodAttribute.cs
- UpdateTracker.cs
- EndpointBehaviorElementCollection.cs
- SettingsBase.cs
- ClientConvert.cs
- PageTheme.cs
- ElapsedEventArgs.cs
- DBParameter.cs
- EntityDesignerUtils.cs
- DockingAttribute.cs
- SettingsPropertyValueCollection.cs
- UnauthorizedAccessException.cs
- FontDifferentiator.cs
- XmlSerializerFactory.cs
- BaseCollection.cs
- Privilege.cs
- ReverseQueryOperator.cs
- XamlStream.cs
- GACMembershipCondition.cs
- PtsPage.cs
- ProtocolsSection.cs
- ConnectionModeReader.cs
- ResourceManagerWrapper.cs
- InstanceStoreQueryResult.cs
- ReflectTypeDescriptionProvider.cs
- UriTemplateQueryValue.cs
- Message.cs
- UnsafeNativeMethods.cs
- XmlHierarchicalEnumerable.cs
- _ScatterGatherBuffers.cs
- SocketAddress.cs
- BinarySerializer.cs
- Visitor.cs
- ConstructorExpr.cs
- SQLMoneyStorage.cs
- SecurityDescriptor.cs
- OAVariantLib.cs
- PasswordBox.cs
- SafeWaitHandle.cs
- CatalogPart.cs
- RawTextInputReport.cs
- TypeTypeConverter.cs
- CommandArguments.cs
- ProjectionCamera.cs
- Shape.cs
- ClientCultureInfo.cs
- HitTestParameters.cs
- CompositeScriptReference.cs
- UserNameSecurityTokenAuthenticator.cs
- ProcessStartInfo.cs
- Rect.cs
- HtmlButton.cs
- ReferenceCountedObject.cs
- MonthChangedEventArgs.cs
- DrawingGroup.cs
- UndirectedGraph.cs
- IIS7UserPrincipal.cs
- XmlCountingReader.cs
- ProcessInfo.cs
- RelOps.cs
- WindowsRichEditRange.cs
- SystemFonts.cs
- X509Utils.cs
- XmlElementAttribute.cs
- CodeEventReferenceExpression.cs
- ControlParameter.cs
- DetailsViewUpdatedEventArgs.cs
- SqlMetaData.cs
- TextFormatter.cs
- MouseEvent.cs
- InternalPermissions.cs
- ping.cs
- ColumnCollection.cs
- TypeConverterHelper.cs
- MergeFailedEvent.cs
- EncodingDataItem.cs
- XmlQualifiedName.cs
- HttpCookiesSection.cs
- BufferedReadStream.cs
- TextBox.cs
- CustomAssemblyResolver.cs
- indexingfiltermarshaler.cs
- RepeaterCommandEventArgs.cs
- Vector3D.cs
- XmlSerializationGeneratedCode.cs
- MaskedTextBox.cs
- Point.cs
- SmtpNetworkElement.cs
- GridViewRowEventArgs.cs
- QueryExtender.cs
- FillRuleValidation.cs
- PropertySourceInfo.cs
- CacheRequest.cs
- CompositeDesignerAccessibleObject.cs
- ClientApiGenerator.cs
- SoapEnumAttribute.cs
- FileFormatException.cs
- PseudoWebRequest.cs
- _IPv6Address.cs
- Schema.cs