Condividi tramite


CReplicationClientError.ErrorCode Property

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Gets or sets the error code that the Commerce Server Staging (CSS) service sets when a CSS method fails.

object ErrorCode { set; get; }

Return Value

A numeric value that specifies the error code.

Remarks

For information about error handling, see CSS API Error Handling.

The CReplicationClientError.ErrorCode property corresponds to the COM property named ReplicationClientError.ErrorCode.

Example

The following example tries to send a file. If it fails, it displays error codes and error descriptions.

CReplicationClient replicationClient = new CReplicationClient();
replicationClient.Initialize("Project1");
try
{
    replicationClient.SendFile("myfile.htm");
}
catch (System.Runtime.InteropServices.COMException)
{
    object[] errors = (object[])replicationClient.GetExtendedErrorInfo();
    // If the ClientError array is not empty, loop through it and display each error
    int numElements = errors.Length;
    if (numElements > 0)
    {
        Console.WriteLine("The following errors were received:");
        for (int i = 0; i < numElements; i++)
        {
            Console.WriteLine("Error code: {0}", ((CReplicationClientError)errors[i]).get_ErrorCode());
            Console.WriteLine("Description code: {0}", ((CReplicationClientError)errors[i]).get_Description());
        }
    }
} 

See Also

Other Resources

CSS API Error Handling

CReplicationClient.GetExtendedErrorInfo Method

CReplicationClientError Class