Collectable errors in AL
This content is archived and is not being updated. For the latest documentation, go to What's new and planned for Dynamics 365 Business Central. For the latest release plans, go to Dynamics 365 and Microsoft Power Platform release plans.
|Enabled for||Public preview||General availability|
|Users, automatically||Oct 1, 2021||Oct 1, 2021|
Allow AL developers to write AL code that returns more than one error. The feature can be used to simplify validation scenarios where users can be presented with a list of things to fix.
To support collectable errors, the following features are now included in AL code:
- New properties on the ErrorInfo data type so that a call to the Error method can state whether the error is collectable.
- New method attribute called ErrorBehavior that lets the AL developer choose to collect and handle errors that have been classified as collectable.
- New methods that let the AL developer handle errors collected in the current method scope.
Using ErrorBehavior.Collect (docs)