Errors and Exceptions

Nonstreaming

To indicate that a standard SDK function has resulted in an error for an expected reason, return the appropriate error code (as opposed to DAQSuccess), as provided in include/daqsdktypes.h.

To indicate that a custom SDK function has resulted in an error, throw a DAQDiagnostic (see daqinterfaces.hpp) containing a custom error code and a diagnosis message string.

To indicate that a standard SDK function has resulted in an error for a reason that is specific to the function of the custom adaptor (vendor-specific error), throw a DAQDiagnostic.

You can define a custom error code as a negative value less than daqsdk::DAQErr_ReservedRangeEnd (see daqsdktypes.h). while a custom warning code can be defined as a positive value greater than daqsdk::DAQWrn_ReservedRangeEnd.

Streaming

To indicate that an error has occurred during the configuration of the stream (configureStream), return a custom error code. You should also implement the DAQStreamAnalog::getDiagnosticFromStatus, which when given a custom error code, returns a string describing the error condition.

To indicate that an error has occurred during streaming (that is, after the stream has started but before it is done or has stopped), return a custom error code or throw an exception.

Related Examples

More About