Error Reporting

If the call succeeds in obtaining a workspace, then the method returns S_OK. However, there are many reasons an error might occur. Sometimes an error can occur even before the connection attempt is made. Here is an example of such an error:
Requested logical name was not found
Other errors can occur during the connection attempt. Here are some examples of other errors:
  • Invalid user ID/password
  • Could not connect to a SAS server
  • Invalid host name
  • Server configuration error
Errors can occur even though a successful connection is established.  Errors that occur when connecting are reported either through the IErrorInfo mechanism (if no SAS workspace is created) or returned in the errorString parameter (if a SAS workspace is created). The Err.Description, IErrorInfo->Description() in C, and errorString both use the same XML format.
If UseXMLInErrorInfo is set to false (it defaults to true), then Err.Description contains only a single error string, which refers to the last connection attempted.
The error information that is returned through XML allows applications to fix the problems that are detected. Here is an example error, in which a successful connection is made, but the first attempt failed:
<connectionAttempts>
<connectionAttempt>
<sasservername>MyServer</sasservername>
<machineDNSName>MyServer.MyCompany.com</machineDNSName>
<saslogin>MyUserID</saslogin>
<status>0x8004274d</status>
<description>Could not establish a connection to the SAS
server on the requested machine. Verify that the SAS server has
been started with the -objectserver option or that the SAS
spawner has been started. Verify that the port Combridge is
attempting to connect to is the same as the port SAS (or the
spawner) is listening on.</description>
</connectionAttempt>
<connectionAttempt>
<sasserver>MyServer2</sasserver>
<machineDNSName>MyServer2.MyCompany.com</machineDNSName>
<saslogin>MyUserID</saslogin>
<status>0x0</status>
<description>Connected</description>
</connectionAttempt>
</connectionAttempts>