HttpError Class¶
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
type.
- Namespace
System.Web.Http
- Assemblies
- Microsoft.AspNetCore.Mvc.WebApiCompatShim
Inheritance Hierarchy¶
System.Object
System.Collections.Generic.Dictionary{System.String,System.Object}
System.Web.Http.HttpError
Syntax¶
[XmlRoot("Error")]
public sealed class HttpError : Dictionary<string, object>, IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IDictionary, ICollection, IReadOnlyDictionary<string, object>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable, ISerializable, IDeserializationCallback, IXmlSerializable
-
class
System.Web.Http.
HttpError
Constructors¶
-
HttpError
()¶ Initializes a new instance of the
System.Web.Http.HttpError
class.public HttpError()
-
HttpError
(Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary, System.Boolean) Initializes a new instance of the
System.Web.Http.HttpError
class for <em>modelState</em>.Arguments: - modelState (Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary) – The invalid model state to use for error information.
- includeErrorDetail (System.Boolean) – <code>true</code> to include exception messages in the error; <code>false</code> otherwise.
public HttpError(ModelStateDictionary modelState, bool includeErrorDetail)
-
HttpError
(System.Exception, System.Boolean) Initializes a new instance of the
System.Web.Http.HttpError
class for <em>exception</em>.Arguments: - exception (System.Exception) – The exception to use for error information.
- includeErrorDetail (System.Boolean) – <code>true</code> to include the exception information in the error;<code>false</code> otherwise.
public HttpError(Exception exception, bool includeErrorDetail)
-
HttpError
(System.String) Initializes a new instance of the
System.Web.Http.HttpError
class containing error message <em>message</em>.Arguments: message (System.String) – The error message to associate with this instance. public HttpError(string message)
-
Properties¶
-
System.Web.Http.HttpError.
ExceptionMessage
¶ The message of the
System.Exception
if available.Return type: System.String public string ExceptionMessage { get; set; }
-
System.Web.Http.HttpError.
ExceptionType
¶ The type of the
System.Exception
if available.Return type: System.String public string ExceptionType { get; set; }
-
System.Web.Http.HttpError.
InnerException
¶ The inner
System.Exception
associated with this instance if available.Return type: System.Web.Http.HttpError public HttpError InnerException { get; }
-
System.Web.Http.HttpError.
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; }
-
System.Web.Http.HttpError.
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; }
-
System.Web.Http.HttpError.
ModelState
¶ The
System.Web.Http.HttpError.ModelState
containing information about the errors that occurred during model binding.Return type: System.Web.Http.HttpError public HttpError ModelState { get; }
-
System.Web.Http.HttpError.
StackTrace
¶ The stack trace information associated with this instance if available.
Return type: System.String public string StackTrace { get; set; }
-
Methods¶
-
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)
-
GetSchema
()¶ Return type: System.Xml.Schema.XmlSchema XmlSchema IXmlSerializable.GetSchema()
-
ReadXml
(System.Xml.XmlReader)¶ void IXmlSerializable.ReadXml(XmlReader reader)
-
WriteXml
(System.Xml.XmlWriter)¶ void IXmlSerializable.WriteXml(XmlWriter writer)
-