OPCDA.NET Client Interface Wrapper
Summary of OPC Error Codes
We have attempted to minimize the number of unique errors by identifying common generic problems and defining error codes that can be reused in many contexts. An OPC server should only return those OPC errors that are listed for the various methods in this specification or are standard Microsoft errors. Note that OLE itself will frequently return errors (such as RPC errors) in addition to those listed in this specification.
The most important thing for a client is to check FAILED for any error return. Other than that, (the statements above not withstanding) a robust, user friendly client should assume that the server may return any error code and should call the GetErrorString function to provide user readable information about those errors.
Fig.1 Standard COM errors that are commonly used by OPC Servers
Value | Description | |
S_OK | 0x0 | |
S_FALSE | 0x1 | |
E_FAIL | 0x80004005 | Unspecified error |
E_INVALIDARG | 0x80070057 | The value of one or more parameters was not valid. This is generally used in place of a more specific error where it is expected that problems are unlikely or will be easy to identify (for example when there is only one parameter). |
E_NOINTERFACE | 0x80004002 | No such interface supported |
E_NOTIMPL | 0x80004001 | Not implemented |
E_OUTOFMEMORY | 0x8007000E | Not enough memory to complete the requested operation. This can happen any time the server needs to allocate memory to complete the requested operation. |
CONNECT_E_ADVISELIMIT | 0x80040201 | Advise limit exceeded for this object |
OLE_E_NOCONNECTION | 0x80040200 | Cannot Unadvise - there is no existing connection |
Fig.2 OPC Specific Errors
Value | Description | |
OPC_E_BADRIGHTS | 0xC0040006 | The Items AccessRights do not allow the operation. |
OPC_E_BADTYPE | 0xC0040004 | The server cannot convert the data between the specified format/ requested data type and the canonical data type. |
OPC_E_DUPLICATENAME | 0xC004000C | Duplicate name not allowed. |
OPC_E_INVALIDCONFIGFILE | 0xC0040010 | The server's configuration file is an invalid format. |
OPC_E_INVALIDFILTER | 0xC0040009 | The filter string was not valid |
OPC_E_INVALIDHANDLE | 0xC0040001 | The value of the handle is invalid. Note: a client should never pass an invalid handle to a server. If this error occurs, it is due to a programming error in the client or possibly in the server. |
OPC_E_INVALIDITEMID | 0xC0040008 | The item ID doesn't conform to the server's syntax. |
OPC_E_INVALID_PID | 0xC0040203 | The passed property ID is not valid for the item. |
OPC_E_NOTFOUND | 0xC0040011 | Requested Object (e.g. a public group) was not found. |
OPC_E_PUBLIC | 0xC0040005 | The requested operation cannot be done on a public group. |
OPC_E_RANGE | 0xC004000B | The value was out of range. |
OPC_E_UNKNOWNITEMID | 0xC0040007 | The item ID is not defined in the server address space (on add or validate) or no longer exists in the server address space (for read or write). |
OPC_E_UNKNOWNPATH | 0xC004000A | The item's access path is not known to the server. |
OPC_S_CLAMP | 0x0004000E | A value passed to WRITE was accepted but the output was clamped. |
OPC_S_INUSE | 0x0004000F | The operation cannot be performed because the object is being referenced. |
OPC_S_UNSUPPORTEDRATE | 0x0004000D | The server does not support the requested data rate but will use the closest available rate. |