HttpError Class¶
Summary¶
Defines a serializable container for storing error information. This information is stored as key/value pairs. The dictionary keys to look up standard error information are available on the [System.Web.Http.HttpErrorKeys](System.Web.Http.HttpErrorKeys.yml) type.
Inheritance Hierarchy¶
System.Object
System.Collections.Generic.Dictionary{System.String,System.Object}
System.Web.Http.HttpError
Syntax¶
public sealed class HttpError : Dictionary<string, object>, IDictionary<string, object>, IDictionary, IReadOnlyDictionary<string, object>, ISerializable, IDeserializationCallback, ICollection<KeyValuePair<string, object>>, ICollection, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable, IXmlSerializable
Constructors¶
-
System.Web.Http.HttpError.HttpError()
Initializes a new instance of the [System.Web.Http.HttpError](System.Web.Http.HttpError.yml) class.
public HttpError()
-
HttpError
(Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary, System.Boolean)¶ Initializes a new instance of the [System.Web.Http.HttpError](System.Web.Http.HttpError.yml) class for <paramref name=”modelState” />.
Arguments: - modelState (Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary) – The invalid model state to use for error information.
- includeErrorDetail (System.Boolean) – <c>true</c> to include exception messages in the error; <c>false</c> otherwise.
public HttpError(ModelStateDictionary modelState, bool includeErrorDetail)
-
HttpError
(System.Exception, System.Boolean) Initializes a new instance of the [System.Web.Http.HttpError](System.Web.Http.HttpError.yml) class for <paramref name=”exception” />.
Arguments: - exception (System.Exception) – The exception to use for error information.
- includeErrorDetail (System.Boolean) – <c>true</c> to include the exception information in the error; <c>false</c> otherwise.
public HttpError(Exception exception, bool includeErrorDetail)
-
HttpError
(System.String) Initializes a new instance of the [System.Web.Http.HttpError](System.Web.Http.HttpError.yml) class containing error message
<paramref name=”message” />.
Arguments: - message (System.String) – The error message to associate with this instance.
public HttpError(string message)
-
Properties¶
-
ExceptionMessage
()¶ The message of the [System.Exception]() if available.
Return type: System.String public string ExceptionMessage { get; set; }
-
ExceptionType
()¶ The type of the [System.Exception]() if available.
Return type: System.String public string ExceptionType { get; set; }
-
InnerException
()¶ The inner [System.Exception]() associated with this instance if available.
Return type: System.Web.Http.HttpError public HttpError InnerException { get; }
-
Message
()¶ The high-level, user-visible message explaining the cause of the error. Information carried in this field should be considered public in that it will go over the wire regardless of the value of error detail policy. As a result care should be taken not to disclose sensitive information about the server or the application.
Return type: System.String public string Message { get; set; }
-
MessageDetail
()¶ A detailed description of the error intended for the developer to understand exactly what failed.
Return type: System.String public string MessageDetail { get; set; }
-
ModelState
()¶ The [System.Web.Http.HttpError.ModelState](System.Web.Http.HttpError.yml) containing information about the errors that occurred during model binding.
Return type: System.Web.Http.HttpError public HttpError ModelState { get; }
-
StackTrace
()¶ The stack trace information associated with this instance if available.
Return type: System.String public string StackTrace { get; set; }
-
Methods¶
-
System.Web.Http.HttpError.GetPropertyValue<TValue>(System.String)
Gets a particular property value from this error instance.
Arguments: - key (System.String) – The name of the error property.
Return type: TValue
Returns: The value of the error property.
public TValue GetPropertyValue<TValue>(string key)
-
System.Web.Http.HttpError.System.Xml.Serialization.IXmlSerializable.GetSchema()
Return type: System.Xml.Schema.XmlSchema XmlSchema IXmlSerializable.GetSchema()
-
ReadXml
(System.Xml.XmlReader)¶ Arguments: - reader (System.Xml.XmlReader) –
void IXmlSerializable.ReadXml(XmlReader reader)
-
WriteXml
(System.Xml.XmlWriter)¶ Arguments: - writer (System.Xml.XmlWriter) –
void IXmlSerializable.WriteXml(XmlWriter writer)
-