Handling of C/AL Error statement

sbraninsbranin Member Posts: 18
edited 2015-04-21 in NAV Three Tier
I am seeing situations in NAV 2015 where the ERROR statement stops processing but does not display the text of the error. I have searched the forums and haven't found any information on this. I did find this mention in the release notes for NAV 2015 Cumulative Update 3:

362556 The ERROR C/AL statement does not execute as expected in some scenarios.

However, I am also seeing the problem in a system with CU4 installed. Is there a way to structure code, such that the text of the ERROR message should not get displayed?

Thanks for any input. Searching for this problem has proved difficult as a very high number of posts include the word "error".

-Steve

Answers

  • sbraninsbranin Member Posts: 18
    I figured this out.

    First, you can suppress the display of ERROR message by calling a Codeunit using the syntax like this
    IF mycodeunit.RUN THEN
    

    Any ERROR messages further up the call stack will not get displayed, they will just cause this IF to fail.

    The difference I was seeing in NAV 2015 vs. NAV 2009 R2 was caused because Microsoft fixed a bug in NAV 2009 where the setting in Warehouse Setup.Receipt Posting Policy did the same thing regardless of which option you choose. By fixing this errors that had not been suppressed in NAV 2009, are now getting suppressed in NAV 2015.
Sign In or Register to comment.