Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 17 Devices > 17.9 LabJack M (T4 / T7 / T8 etc) > 17.9.4 Calling the LabJack M Driver

17.9.4.3 Error Handling in Script

Scroll Prev Top Next More

Unlike the LabJackUD driver, the LabJackM driver uses standard DAQFactory error handling.  When the driver has an error, it throws the error which then can be caught using a try/catch() block.  Please see section 5.19 for more detail.  For example, the LJM_eStreamStart() can generate an error in a number of conditions, such as setting too high of a scan rate.  If you don't add any error handling, the script will just exit and the error will display in the Command / Alert window.  But often it is better to catch the error in script so you can do something else about it.  For example:

 

try
   LJM_eStreamStart("ANY", {"AIN0", "AIN1"}, scanRate, scansPerRead, 1)
catch()
   System.MessageBox("Error starting stream: " + strLastError)
endcatch

Note that all errors, other than loading the driver itself, start with "LabJackM:".