Try, Catch equivalent [moved from RobotStudio]

Hi,

Is there anything in RAPID, equivalent to using try and catch statements in C#?

I am trying to read CSV files but want my program pointer to go back to main when it fails to open a file without resetting the robot or acknowledging any errors.

Hi,

you can use the error handler inside each routine to handle this problem.

Example:

PROC ReadCSV()

Open “HOME:” \File:= “Mydata.CSV”, logfile \Read;

ERROR

IF ERRNO = ERR_FILEOPEN THEN

!Handle the error

EXIT;

ENDIF

ENDPROC

Please refer to the RAPID manual for further information.

Regards

Micky