Export (0) Print
Expand All

Handling Errors

If you are writing a C++ application, the COM interoperability layer translates the exceptions thrown by the Compute Cluster Pack (CCP) to HRESULT values. The CCP-specific HRESULT values are not documented. Instead of testing for specific HRESULT values, test only for success or failure.

If an error occurs, you can use the ICluster::get_ErrorMessage, IJob::get_ErrorMessage, and ITask::get_ErrorMessage methods to get a description of the error. When the status of a job or task is Failed, the error message contains the description of the run-time error that occurred.

The following C++ example shows how to get the description when an error occurs.



hr = pCluster->SubmitJobs(pJobIds, 
                          _bstr_t(L"domain\\username"), 
                          NULL, 
                          VARIANT_TRUE, 
                          0); 
if (FAILED(hr))
{
  BSTR bstrMessage = NULL;
 
  wprintf(L"pCluster->SubmitJobs failed.\n");
  hr = pCluster->get_ErrorMessage(&bstrMessage);
  wprintf(L"%s\n", bstrMessage);
  SysFreeString(bstrMessage);
}


Related topics

Using CCP

 

 

Show:
© 2014 Microsoft