$error » History » Version 1
Per Amundsen, 08/12/2015 08:37 AM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | *$error* |
||
| 4 | |||
| 5 | When an error occurs, the script will jump to :error and continue running, [[$error]] will return the error message. |
||
| 6 | |||
| 7 | *Example* |
||
| 8 | |||
| 9 | <pre> |
||
| 10 | alias Example { |
||
| 11 | ; Add a intentional error. |
||
| 12 | noop $hget( |
||
| 13 | |||
| 14 | ; Add a :error label to catch the error. |
||
| 15 | :error |
||
| 16 | |||
| 17 | ; Print the error caught. |
||
| 18 | echo -ag The error is $error |
||
| 19 | } |
||
| 20 | </pre> |