| 1 |
/* |
| 2 |
* smacro try_assign - Assign the evaluation of the try-catch |
| 3 |
* |
| 4 |
* @assign_to: Where the evaluated value is stored in. |
| 5 |
* @try_body: Expression making up the try body. |
| 6 |
* @catch_body: Epxression making up the catch body. |
| 7 |
* |
| 8 |
* Description: Executes a try catch statement. If there was no error, |
| 9 |
* a provided variable is assigned to the evaluation of the try body, |
| 10 |
* otherwise to the evaluation of the catch body. This assumes that the try and |
| 11 |
* catch body are meant to return a value. If they do not, then do not use this |
| 12 |
* macro. If either of the bodies do not return a value, then a compilation |
| 13 |
* error occurs. |
| 14 |
* |
| 15 |
*/ |
| 16 |
|
| 17 |
@define try_assign(assign_to, try_body, catch_body) %( |
| 18 |
try { |
| 19 |
@assign_to = @try_body |
| 20 |
} catch { |
| 21 |
@assign_to = @catch_body |
| 22 |
} |
| 23 |
%) |