CompilerRuntimeErrorAction
is an option for FunctionCompile that determines what should happen when an unrecoverable error takes place while computing with low-level code.
Details
![](Files/CompilerRuntimeErrorAction.en/details_1.png)
- With the default setting of Automatic, the computation will be rerun in the Wolfram Engine if it avoids compiler-specific code.
- Possible settings for CompilerRuntimeErrorAction are:
-
Automatic rerun the computation in the Wolfram Engine if it avoids compiler-specific code "Evaluate" always rerun the computation in the Wolfram Engine None return a failure object that represents the error fun apply fun to the failure object and return the result
Examples
Basic Examples (3)
Generate compiled code with the default CompilerRuntimeErrorAction:
There is an error due to integer overflow and the computation is rerun by the evaluator:
![](Files/CompilerRuntimeErrorAction.en/1.gif)
Generate compiled code with CompilerRuntimeErrorAction set to None:
Now the error is not rerun in the Wolfram Engine; instead a Failure is returned:
![](Files/CompilerRuntimeErrorAction.en/2.gif)
If the function contains code specific for the compiler, the default setting of CompilerRuntimeErrorAction does not run in the evaluator:
Generate compiled code with CompilerRuntimeErrorAction set to None:
Now the error is not rerun in the Wolfram Engine:
![](Files/CompilerRuntimeErrorAction.en/3.gif)
Setting CompilerRuntimeErrorAction to "Evaluate" indicates that if any error occurs, the computation will be rerun in the evaluator:
Now the error is rerun in the Wolfram Engine:
![](Files/CompilerRuntimeErrorAction.en/4.gif)
![](Files/CompilerRuntimeErrorAction.en/5.gif)
![](Files/CompilerRuntimeErrorAction.en/6.gif)
CompilerRuntimeErrorAction can take a function to apply to the failure object:
Text
Wolfram Research (2024), CompilerRuntimeErrorAction, Wolfram Language function, https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html.
CMS
Wolfram Language. 2024. "CompilerRuntimeErrorAction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html.
APA
Wolfram Language. (2024). CompilerRuntimeErrorAction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html