Showing description of a catched error

I have following problem: When processing a list of several jobs, every job is run this way: Loop IsError = NOT CODEUNIT.RUN(xyz,blabla); Loop End Here all jobs are processed even if there is an error somewhere in processing of some job in middle of list. So i know that there was an error, but i don’t know WHICH error. Is there any possibilty to get the last error or something similiar?

Can you provide more information? Looking at this pseudo code you would get the last error, as the error flag is updated on every iteration of the loop.

Stefan, are you refering to possible errors generated inside the Codeunits? You have no way of knowing what raised the error from the calling code. You would need to handle each error and create something like a log inside the Codeunits so the calling code could then read this log.

hi nelson, yes you are right, i want to show the error which is generated within the codeunit … i also assumed that there is no possibilty to show this error, just wanted to go sure. @SJohn: i don’t get the last error, i only get true or false (TRUE = codeunit run ok // FALSE = error inside codeunit)

I don’t know what you mean by “show” or “get” error, but this can easily be achieved: Loop IsError = NOT CODEUNIT.RUN(xyz,blabla); IF IsError AND StopAndShowError THEN CODEUNIT.RUN(xyz,blabla); Loop End This, of course, has the (probably undesired) sideaffect that it would terminate execution at the very first error-instant. Alternatively you could “mark” those instances where errors occur and run them afterwards (one by one) in order to “get” the error(s). As a sidenote - which in my experience very few know - pls. be aware that any successful (i.e. errorfree) use of the construction IF CODEUNIT.RUN will release an implicit and invisible COMMIT at the very end of said codeunit.

quote:


Originally posted by Steffen Voel As a sidenote - which in my experience very few know - pls. be aware that any successful (i.e. errorfree) use of the construction IF CODEUNIT.RUN will release an implicit and invisible COMMIT at the very end of said codeunit.


so “IF CODEUNIT.RUN” is a COMMIT?

yup

quote:


Originally posted by Steffen Voel
I don’t know what you mean by “show” or “get” error, but this can easily be achieved: Loop IsError = NOT CODEUNIT.RUN(xyz,blabla); IF IsError AND StopAndShowError THEN CODEUNIT.RUN(xyz,blabla); Loop End This, of course, has the (probably undesired) sideaffect that it would terminate execution at the very first error-instant. Alternatively you could “mark” those instances where errors occur and run them afterwards (one by one) in order to “get” the error(s).


Meanwhile i also came to this solution … i think i will save the number of the failed job line and then at end of batch job list i will rerun this job! So i dont have the problem you describe above.

quote:


As a sidenote - which in my experience very few know - pls. be aware that any successful (i.e. errorfree) use of the construction IF CODEUNIT.RUN will release an implicit and invisible COMMIT at the very end of said codeunit.


I noticed the same behaviour in our Batch Job processing few days ago.