In pre-NAV 2016 versions we have only one standard opportunity to catch error in runtime. And this awesome opportunity is CodeunitVariableName.RUN or CODEUNIT.RUN(CODEUNIT::”Codeunit Name”[, CodeunitRec]). Let’s take a look how it works and how to use it in your pre-NAV 2016 developments.

First step will be a creation of error generating codeunit.

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

Ok. That’s great. Let’s create caller codeunit to call first one.

Save and run it. If we try to run caller codeunit, we see the same error as we see previously calling error generating codeunit.

Perfect. Now we change caller codeunit a bit to catch error generated by error generating codeunit.

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


Good job!