Class WebErrorsHandling
Defines the error handling settings used for wrapping internal exceptions in REST or OData services.
Inherited Members
Namespace: Nevatech.Vsb.Repository.Entities
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public sealed class WebErrorsHandling : IValidator, IEquatable<WebErrorsHandling>, IExtensibleDataObject
Constructors
WebErrorsHandling()
Initializes new instance with default settings.
Declaration
public WebErrorsHandling()
Properties
AccessDeniedMessage
Gets or sets the custom error message that will be sent to the client, if client is not authorized to perform an action. If not set then default message will be used.
Declaration
public string AccessDeniedMessage { get; set; }
Property Value
Type | Description |
---|---|
String |
AccessDeniedStatusCode
Gets or sets the HTTP status code that will be sent to the client, if he is not authorized to perform an action. Default is 403 (Forbidden).
Declaration
public int AccessDeniedStatusCode { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
ErrorHandlerFullyQualifiedTypeName
Gets or sets the fully qualified name of the type implementing IWebErrorHandler. The instance of this type will be called to format or alter the response error message.
Declaration
public string ErrorHandlerFullyQualifiedTypeName { get; set; }
Property Value
Type | Description |
---|---|
String |
ErrorMessage
Gets the summary of validation errors.
Declaration
public string ErrorMessage { get; }
Property Value
Type | Description |
---|---|
String |
ExtensionData
Gets or sets ExtensionDataObject that enables serialization round-trips.
Declaration
public ExtensionDataObject ExtensionData { get; set; }
Property Value
Type | Description |
---|---|
ExtensionDataObject |
FaultExpression
Gets or sets the expression matching response messages containing application errors (faults). The expression is evaluated for each response message with the status code matching FaultStatusCodes value. Default is MatchAllExpression.
Declaration
public AuthorizationExpressionBase FaultExpression { get; set; }
Property Value
Type | Description |
---|---|
AuthorizationExpressionBase |
FaultStatusCodes
Gets or sets the list of HTTP status codes indicating that response message contains an application error (fault). The codes can be comma-separated or defined as ranges, for example, "400,401,410-440,500-". By default, or if property is set to NULL, all messages with status code 400 or greater are treated as system errors.
Declaration
public string FaultStatusCodes { get; set; }
Property Value
Type | Description |
---|---|
String |
InternalErrorStatusCode
Gets or sets the HTTP status code that will be sent to the client in case of any other virtual service generated exception (no connectivity, an invalid protocol, etc). Default is 500 (Internal Server Error).
Declaration
public int InternalErrorStatusCode { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
InvalidRequestMessage
Gets or sets the custom error message that will be sent to the client, if client provided an invalid URI or HTTP headers that cannot be matched to any operation. If not set then default message will be used.
Declaration
public string InvalidRequestMessage { get; set; }
Property Value
Type | Description |
---|---|
String |
InvalidRequestStatusCode
Gets or sets the HTTP status code that will be sent to the client, if client provided an invalid URI or HTTP Method/HTTP headers that cannot be matched to any operation. Default is 404 (Not Found).
Declaration
public int InvalidRequestStatusCode { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
MessageContentFormat
Gets or sets the value defining the message body format of the error message returned to the client. Default is XML.
Declaration
public ContentFormat MessageContentFormat { get; set; }
Property Value
Type | Description |
---|---|
ContentFormat |
Methods
Equals(WebErrorsHandling)
Determines whether the specified object is equal to the current object.
Declaration
public bool Equals(WebErrorsHandling other)
Parameters
Type | Name | Description |
---|---|---|
WebErrorsHandling | other | The object to compare with the current object. |
Returns
Type | Description |
---|---|
Boolean | True, if objects are equal. False, if objects are not equal. |
Equals(Object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
Boolean | True, if objects are equal. False, if objects are not equal. |
Overrides
GetErrorHandler()
Returns a new or existing instance of the IWebErrorHandler type configured in this object.
Declaration
public IWebErrorHandler GetErrorHandler()
Returns
Type | Description |
---|---|
IWebErrorHandler | New or existing instance of the IWebErrorHandler type configured in this object. |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | Hash code of the current instance. |
Overrides
IsFault(ref Message, ServiceConfiguration)
Evaluates provided message and returns flag indicating that message contains an application error (fault).
Declaration
public bool IsFault(ref Message message, ServiceConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
Message | message | Response message to be evaluated. |
ServiceConfiguration | configuration | Full runtime configuration of the current service. |
Returns
Type | Description |
---|---|
Boolean | True, if provided message contains a fault. False, otherwise. |
Validate()
Evaluates the state of this object.
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
Boolean | True if state is valid; otherwise, false. |