09.12.2012 Views

Basic Characteristics RAPID

Basic Characteristics RAPID

Basic Characteristics RAPID

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

<strong>RAPID</strong> Summary Error Recovery<br />

9 Error Recovery<br />

Many of the errors that occur when a program is being executed can be handled in the<br />

program, which means that program execution does not have to be interrupted. These<br />

errors are either of a type detected by the robot, such as division by zero, or of a type<br />

that is detected by the program, such as errors that occur when an incorrect value is<br />

read by a bar code reader.<br />

9.1 Programming principles<br />

When an error occurs, the error handler of the routine is called (if there is one). It is<br />

also possible to create an error from within the program and then jump to the error handler.<br />

If the routine does not have an error handler, a call will be made to the error handler in<br />

the routine that called the routine in question. If there is no error handler there either,<br />

a call will be made to the error handler in the routine that called that routine, and so on<br />

until the internal error handler of the robot takes over and outputs an error message and<br />

stops program execution.<br />

In the error handler, errors can be handled using ordinary instructions. The system data<br />

ERRNO can be used to determine the type of error that has occurred. A return from the<br />

error handler can then take place in various ways.<br />

In future releases, if the current routine does not have an error handler, the internal<br />

error handler of the robot takes over directly. The internal error handler outputs an<br />

error message and stops program execution with the program pointer at the faulty<br />

instruction.<br />

So, a good rule already in this issue is as follows: if you want to call the error handler<br />

of the routine that called the current routine (propagate the error), then:<br />

- Add an error handler in the current routine<br />

- Add the instruction RAISE in this error handler.<br />

9.2 Creating an error situation from within the program<br />

Instruction Used to:<br />

RAISE “Create” an error and call the error handler<br />

<strong>RAPID</strong> Reference Manual 3-25

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

Saved successfully!

Ooh no, something went wrong!