IBackgroundCopyJob::GetError method (bits.h)

Retrieves the error interface after an error occurs.

BITS generates an error object when the state of the job is BG_JOB_STATE_ERROR or BG_JOB_STATE_TRANSIENT_ERROR. The service does not create an error object when a call to an IBackgroundCopyXXXX interface method fails. The error object is available until BITS begins transferring data (the state of the job changes to BG_JOB_STATE_TRANSFERRING) for the job or until your application exits.

Syntax

HRESULT GetError(
  [out] IBackgroundCopyError **ppError
);

Parameters

[out] ppError

Error interface that provides the error code, a description of the error, and the context in which the error occurred. This parameter also identifies the file being transferred at the time the error occurred. Release ppError when done.

Return value

This method returns the following HRESULT values, as well as others.

Return code Description
S_OK
Successfully generated the error object.
BG_E_ERROR_INFORMATION_UNAVAILABLE
The error interface is available only after an error occurs (BG_JOB_STATE_ERROR or BG_JOB_STATE_TRANSIENT_ERROR) and before BITS begins transferring data (BG_JOB_STATE_TRANSFERRING).

Remarks

The job is placed in an error state on fatal errors or after the no-progress-timeout period expires for transient errors (this period is retrieved from the GetNoProgressTimeout method). Use one of the following options to determine if the job is in error:

The IBackgroundCopyError interface contains information that you use to determine the cause of the error and if the transfer process can proceed. After you determine the cause of the error, perform one of the following options: If the job remains in an error state for 90 days (default JobInactivityTimeout Group Policy), the service removes the job from the queue and deletes the temporary files on the client; job deletion does not affect files that have been successfully uploaded.

To determine whether the upload, reply, or server application portion of an upload-reply job failed, call the IBackgroundCopyError::GetError method to retrieve the context in which the error occurred. The server application failed if the context is BG_ERROR_CONTEXT_REMOTE_APPLICATION. If the error is with the upload or reply, the context is BG_ERROR_CONTEXT_REMOTE_FILE. The upload failed if the BytesTotal member of the BG_JOB_REPLY_PROGRESS structure is BG_SIZE_UNKNOWN. Otherwise, the reply failed.

Examples

See the example code in the Handling Errors topic.

Requirements

Requirement Value
Minimum supported client Windows XP
Minimum supported server Windows Server 2003
Target Platform Windows
Header bits.h
Library Bits.lib
DLL QmgrPrxy.dll

See also

IBackgroundCopyCallback::JobError

IBackgroundCopyError

IBackgroundCopyJob::GetState