Expand Minimize

WsCreateFaultFromError function

Constructs a WS_FAULT from a specified error object.

Syntax


HRESULT WINAPI  WsCreateFaultFromError(
  _In_   WS_ERROR* error,
  _In_   HRESULT errorCode,
  _In_   WS_FAULT_DISCLOSURE disclosure,
  _In_   WS_HEAP* heap,
  _Out_  WS_FAULT* fault
);

Parameters

error [in]

Pointer to a WS_ERROR structure representing the error object from which to construct the fault.

errorCode [in]

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.

disclosure [in]

WS_FAULT_DISCLOSURE enumeration that controls what information is copied from the error object to the fault object.

heap [in]

Pointer to a WS_HEAP structure representing the heap from which to allocate memory for the returned fault object.

fault [out]

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 codeDescription
E_INVALIDARG

One or more arguments are invalid.

E_OUTOFMEMORY

Insufficient memory to complete the operation.

Other Errors

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 the WS_ERROR_PROPERTY_ID enumeration.

Requirements

Minimum supported client

Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | Windows Store apps]

Header

WebServices.h

Library

WebServices.lib

DLL

WebServices.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft