Applies To:
  • CitectSCADA 3.10

Error handling is now thread based in version 3.10 and greater see Q1742 for details on the changes. With this change each cicode thread gets its own unique instance of the error code and trapping. If you setup an error handler using OnEvent(2, ErrorHandler) when you call IsError() will get the current error of the error handler not the cicode thread which caused the error. 

You may work around this problem by calling GetGblInt(5) in version 3.0 to 3.10. Calling GetGlbInt(5) will return the global IsError() value. This error is not reset when you call GetGblInt(5) and should only be used in an error handler as other cicode threads can modify this variable. While the error handler is running all other cicode threads will be waiting and will not be able set the error code so it is safe to be called in this case.

In version 3.2 and later if you call IsError() in the error handler you will automatically get the error code from the cicode thread which caused the error to occur. So you may upgrade to version 3.2 to also solve this problem.