WsCreateFaultFromError function (webservices.h)
Constructs a WS_FAULT from a specified error object.
Syntax
HRESULT WsCreateFaultFromError(
[in] WS_ERROR *error,
[in] HRESULT faultErrorCode,
[in] WS_FAULT_DISCLOSURE faultDisclosure,
[in] WS_HEAP *heap,
[out] WS_FAULT *fault
);
Parameters
[in] error
Pointer to a WS_ERROR structure representing the error object from which to construct the fault.
[in] faultErrorCode
The HRESULT error code returned from the function that failed. The HRESULT value cannot be a success code.
This error code is never included in the fault directly, but is used as a fallback mechanism for creating a fault string if the error object does not contain any error strings.
[in] faultDisclosure
WS_FAULT_DISCLOSURE enumeration that controls what information is copied from the error object to the fault object.
[in] heap
Pointer to a WS_HEAP structure representing the heap from which to allocate memory for the returned fault object.
[out] fault
Pointer to a WS_FAULT structure representing the returned fault object. The fields of the fault object are good until WsFreeHeap or WsResetHeap is called to release the specified heap resources.
Return value
If the function succeeds, it returns NO_ERROR; otherwise, it returns an HRESULT error code.
Return code | Description |
---|---|
|
One or more arguments are invalid. |
|
Insufficient memory to complete the operation. |
|
This function may return other errors not listed above. |
Remarks
If the error object contains a fault (that is, the WS_FAULT_ERROR_PROPERTY_FAULT value of WS_FAULT_ERROR_PROPERTY_ID is non-NULL), then that fault is selected to construct the returned fault.
If the error object does not contain a fault (WS_FAULT_ERROR_PROPERTY_FAULT is NULL), a generic fault with a generic fault code (and no reason text) is selected to construct the returned fault.
If the selected fault does not include any reason text, the fault reason text is constructed according to the value of disclosure parameter:
- WS_FULL_FAULT_DISCLOSURE All the error strings present in the error object are appended together to form the reason text. If there are no strings, the string associated with the errorCode parameter is used.
- WS_MINIMAL_FAULT_DISCLOSURE A generic error string is used.
By default, the language of any language-dependent information in the error object is the current user default UI language. However, you can change the language by setting the WS_ERROR_PROPERTY_LANGID property. See the WS_ERROR_PROPERTY_ID enumeration.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 R2 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | webservices.h |
Library | WebServices.lib |
DLL | WebServices.dll |