12.07.2015 Views

RAPID reference manual - Technology

RAPID reference manual - Technology

RAPID reference manual - Technology

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

RaiseToUserRobotWare-OSInstructionPROC routine2()VAR num n:=0;......reg1:=reg2/n;......ERRORIF ERRNO = ERR_DIVZERO THENRaiseToUser \Continue \ErrorNumber:=ERR_MYDIVZERO;ELSERaiseToUser \BreakOff;ENDIFENDPROCENDMODULEThe division by zero in routine2 will propagate up to the error handler in main routinewith the errno set to ERR_MYDIVZERO. The TRYNEXT instruction in main errorhandler will then cause the program execution to continue at the instruction after thedivision by zero in routine2. The \Continue switch controls this behavior.If any other errors occur in routine2 the \BreakOff switch force the execution to continuefrom the error handler in main routine. In this case the undo handler in routine1will be executed while raising to user level. The RETRY instruction in the error handlerin main routine will execute routine1 from the beginning ones again.The undo handler in routine1 will also be executed in the \Continue case if a followingRAISE or RETURN is done on the user level.ArgumentsRaiseToUser [ \Continue] | [ \BreakOff] [ \ErrorNumber][ \Continue] Data type: switchContinue the execution in the routine that caused the error.[ \BreakOff] Data type: switchBreak off the call chain and continue execution at the user level. Any undo handlerin the call chain will be executed apart from the undo handler in the routinethat raised the error.One of argument \Continue or \BreakOff must be programmed.[ \ErrorNumber] Data type: errnumAny number between 1 and 90 that the error handler can use to locate the errorthat has occurred (the ERRNO system variable).It is also possible to book an error number outside the range 1-90 with the instructionBookErrNo.372 <strong>RAPID</strong> <strong>reference</strong> <strong>manual</strong> - part 1a, Instructions A-R

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!