is an option for FunctionCompile that determines what should happen when an unrecoverable error takes place while computing with low-level code.
CompilerRuntimeErrorAction
is an option for FunctionCompile that determines what should happen when an unrecoverable error takes place while computing with low-level code.
Details
- 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:
comp = FunctionCompile[Function[{Typed[x, "UnsignedInteger8"], Typed[y, "UnsignedInteger8"]}, x + y]]There is an error due to integer overflow and the computation is rerun by the evaluator:
comp[250, 250]Generate compiled code with CompilerRuntimeErrorAction set to None:
compRaw = FunctionCompile[Function[{Typed[x, "UnsignedInteger8"], Typed[y, "UnsignedInteger8"]}, x + y], CompilerRuntimeErrorAction -> None]Now the error is not rerun in the Wolfram Engine; instead a Failure is returned:
compRaw[250, 250]If the function contains code specific for the compiler, the default setting of CompilerRuntimeErrorAction does not run in the evaluator:
fun = Function[{Typed[x, "UnsignedInteger8"], Typed[y, "UnsignedInteger8"]}, Module[ {ptr = ToRawPointer[x + y]}, FromRawPointer[ptr]]];Generate compiled code with CompilerRuntimeErrorAction set to None:
compRaw = FunctionCompile[fun];Now the error is not rerun in the Wolfram Engine:
compRaw[250, 250]Setting CompilerRuntimeErrorAction to "Evaluate" indicates that if any error occurs, the computation will be rerun in the evaluator:
compRaw = FunctionCompile[fun, CompilerRuntimeErrorAction -> "Evaluate"];Now the error is rerun in the Wolfram Engine:
compRaw[250, 250]CompilerRuntimeErrorAction can take a function to apply to the failure object:
fun = Function[{Typed[x, "UnsignedInteger8"], Typed[y, "UnsignedInteger8"]}, x + y];
compRaw = FunctionCompile[fun, CompilerRuntimeErrorAction -> Framed];The failure is returned wrapped in a frame:
compRaw[250, 250]Tech Notes
Related Guides
History
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
BibTeX
@misc{reference.wolfram_2026_compilerruntimeerroraction, author="Wolfram Research", title="{CompilerRuntimeErrorAction}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_compilerruntimeerroraction, organization={Wolfram Research}, title={CompilerRuntimeErrorAction}, year={2024}, url={https://reference.wolfram.com/language/ref/CompilerRuntimeErrorAction.html}, note=[Accessed: 13-June-2026]}