Previous parts:

#1 Catch it interactively (pre-NAV 2016)

And we continue our error catching series.

In this post we will try to use modern opportunity presented in NAV 2016, to catch error in runtime. As usual, we begin at the beginning, and create new codeunit.

Save and run it. You will see something like this.

Perfect. Now we change GetAnError function properties to let it be catchable.

Also we change code a bit.

Save and run it. And (surprise!) we suppressed error message, and see just a notification messages.

Good job!