ERROR dialog does not display
Steve_Contris
Member Posts: 114
I am having a problem getting an error dialog to be shown. I can step right onto the line in the debugger where ERROR is called and the code unit it is called from seems to terminate, but I never see the ERROR dialog. Is this caused by other progress windows that are already being shown? Is there something I should be doing to force it to be processed?
What would Elvis do?
0
Comments
-
That depends on how the error is programmed. If it says ERROR('') then you're never going to see an error box. Put something between the quotes and you should see that pop up.0
-
Also if you running the code with
If codeunit.run Then
do this or other,
you won't see the error. The code is basically capturing the error and
codeunit.run returns a true or false.0 -
If you have access to the trace functionality, you may need to manually step through the code until it fails.
The problem can be a statement combination like this:
INSERT;
DELETE;
MODIFY; // FAILURE POINT
Message('All Done!'); // Error Point
Why? When no return value is used on database functions, the database operation set is cached and sent to the server as a batch for more efficient processing. If the debugger is not turned on, then the error will be ambiguous.0 -
If the Result is empty and not zero, then the process is stopped but nothing is shown.0
-
Are You able to put some part of the code? This will help us.0
-
sorry i did not respond sooner for some reason i am not getting email notifications of these postings.
anyway, here is a snippet showing how ERROR is being called:
IF EXISTS(TempReqFileName2) THEN
ERROR( 'A temporary credit card file exists.');
This line of code is being executed in a codeunit called from a codeunit called from a report, but the codeunit.run is not used. - the codeunit functions are called directly.
It seems that when ERROR is called here it is only terminating the code unit that it is called from and the message never shows up. Maybe that is just how it works?What would Elvis do?0 -
I made a simple example to test Your situation. I tried to Run it with couple possibilities, but still it was working very well. Only by using the combination of CU.RUN and IF (Thanks ara3n) I was able to terminate error messages [On whole rout (Report -> CU1 -> CU2 -> CU3) it’s stopped pop ups].
I know that this is ‘silly’, but try to post an Error from this CU, without any IF condition (maybe on beginning of it). Try to post an error from a higher (sooner) CU, before calling CU.Function()… Move on up, until You see Error pop up. This way You will be able to specify, which CU is responsible for terminating them.
Good Luck0 -
after my last post i realized that ther is an instance of IF CU.RUN THEN in the mix - I had not seen it before - there are too many levels to this!
So, that must be what is stopping the messages. If I remove the IF statement and set a local variable with the return value from the CU.RUN statment will that allow the messages?
I guess I will try that to see. Thanks for the helpWhat would Elvis do?0 -
grazie belias!
That should work fine in this case - I would like to get the original message to come up but this is a good enough work-around.What would Elvis do?0 -
Then change it from
IF Codeunit.RUN THEN...
to this:Codeunit.RUN;
That will make the original message come up.0 -
A tried removing the IF statement but the error messages in the code unit being RUN do not come up - they only cause the code unit execution to exit.What would Elvis do?0
-
That seems to be impossible... errors are only suppressed within the IF statement, without it you should see the message.0
-
Well, maybe there's something like:
MyBoolean := Codeunit.RUN;
in that case the error is also suppressed.
Basically:
If you use the return value of the codeunit it suppresses the error, otherwise you should see the actual message come up.0 -
for debugging purposes try changing your ERROR(...)
with IF CONFIRM('error triggered , do you want to terminate transaction ?') THEN ERROR(...)0 -
Assigning the results of the RUN is exactly what was happening. So it is not really the IF as much as it is using the results of the RUN statement that suppresses the error.What would Elvis do?0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

