Error Handling

Error Treatment in API Functions

API functions return the value EPL_ERROR if an error occurs during their execution. Using the eplGetLastError function you can query the error ID that provides you with additional information on the error. You can find possible errors in the Error constants reference. They are defined in the EplanApiDefs.h header file and have the prefix EPL_ERR.

Error Treatment in Commands

If an error occurs during the execution of a command, the eplExecuteCommand function returns the value EPL_ERROR. Here, too, you can query the error ID by using the eplGetLastError function.

Commands furthermore manage an error log in the form of the indexed parameters EPL_PARAM_COMMAND_ERROR_ID and EPL_PARAM_COMMAND_ERROR_DESCRIPTION. Using this error log, the commands can also report several errors together with a detailed text description. These messages and error IDs are queried just like any other parameter by using the eplGetParam API function.

If you wish to write the error IDs of your own commands into the error log, you can use the eplSetLastError function to do so. In addition, your own error IDs should be written into the Param_Command_ERROR.ID. Index 0 gives the number of the already included IDs. This number has to be increased for every newly entered error message.