I would like to make a log table which contain run-time error log when error occur during runtime. For example when user use dataport to import invalid format, an error occured then write to error log table.
It is very hard work to do that, because you have no tool for catching error within C/SIDE... you can use some external library which will detect the error window, read the text and save it... I think that there is some posts about component, which is able to read the error message and close the error window. Search for it... it can be good start for you...
Isn't that event meant to catch an error raised by the timer itself? Wouldn't it be kind of silly to create a timer event just to catch the errors caused by that timer?
Or does that event catch errors caused elsewhere in the system?
First: I don't use it this way at all.
Second: It catches errors during the proces initiated by the timer event. (At least, it does in my NAS Service, don't know for sure it will when you don't use a NAS).
When you do this with a GUI client (that is, not NAS) then the user gets the error message box where he/she must click OK to proceed. After dealing with the message box the TimerError event runs.
Or you can use external component to "click" the OK button on the error message (someone created it - I saw it somewhere there...) :-) but it is only workaround...
I think error handling is on the top of all Navision developers. I know I used to mention it to anyone from Navision that came into our office, I mentioned it when I visited Denmark, and now I mention it every time when I speak to any MS Navision person. If I end up at the MS summit this year I will mention it again to anyone who will listen.
I have mentioned it so many times without results I have lost all faith that it will ever happen in C/AL. Once we get the big C# interface we're all rooting for, it'll be different. Untill then we'll have to keep debugging.
Waldo
you mentioned that nothing will change in development environment, but in 4.0 SP1 they've added 3 new function to the API. FINDFIRST,FINDLAST,FINDRECORSET
I can still hope they'll add just something new in there.
Ahmed Rashed Amini
Independent Consultant/Developer
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
This is off course only useful when using the timer :-/
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
I wanna say thank you to both of you for your help. =D>
Waldo, Could you please show me a little example to use Navision Timer to catch an error message ? :idea:
Else, it would be a bit of "dirty coding", i think. Something like this:
OnRun()
intInterval := 1000; // 1 second
myTimer.Interval := intInterval;
myTimer.Enabled := TRUE;
myTimer::Timer(Milliseconds : Integer)
myTimer.Enable := FALSE;
ExecuteMyCode;
myTimer::TimerError(ErrorString : Text[1024])
WriteLog(ErrorString);
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Or does that event catch errors caused elsewhere in the system?
RIS Plus, LLC
First: I don't use it this way at all.
Second: It catches errors during the proces initiated by the timer event. (At least, it does in my NAS Service, don't know for sure it will when you don't use a NAS).
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
RIS Plus, LLC
Sorry for this ...
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
It would be so nice to have simple Exception Handling available within Navision.
for example
if NOT CodeUnit.RUN then
NavGetLastError()
<would be great >
How about using this community as a vehicle to directly address Navision Development at Microsoft regarding this (and possible other) issue(s)?
:-k
MBS NAV Consultant
RIS Plus, LLC
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Nothing is going to change about the development environment or whatsoever.
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
I have mentioned it so many times without results I have lost all faith that it will ever happen in C/AL. Once we get the big C# interface we're all rooting for, it'll be different. Untill then we'll have to keep debugging.
RIS Plus, LLC
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
RIS Plus, LLC
you mentioned that nothing will change in development environment, but in 4.0 SP1 they've added 3 new function to the API. FINDFIRST,FINDLAST,FINDRECORSET
I can still hope they'll add just something new in there.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
RIS Plus, LLC
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
what i have to do in NavGetLastError() ????
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.