TryFunction Property

Specifies the function to be try function, which can be used to catch and handle errors and exceptions that occur when code is run.

Applies to

C/AL functions.


In test and upgrade codeunits, this property only applies to normal functions as specified by the FunctionType Property (Test Codeunits) or FunctionType Property (Upgrade Codeunits).


Try functions in C/AL enable you to handle errors that occur in the application during code execution. For example, with try functions, you can provide more user-friendly error messages to the end user than those thrown by the system. You can use try functions to catch errors/exceptions that thrown by Dynamics NAV or exceptions that are thrown during .NET Framework interoperability operations.

For more information, see Handling Errors by Using Try Functions.

See Also

C/AL Function Statements