>Is there a way to know what datasession is active for each line #/program level in the call stack?
>Meaning, let's say I have the following call stack:
>
>CALL STACK
>///////////////////////////////////////////////
>
>6 MyGlobalErrorObject.HANDLE_ERROR
>
>5 MyGlobalErrorObject.ERROR
>
>4 SomeForm.Button.ERROR
>
>3 SomeForm.Button.CLICK
>
>2 MyApp.ReadEvents
>
>1 MAIN.PRG
>
>In the error handler HANDLE_ERROR method (program level 6 in this example), is there any way to know what datasession is/was active when the error condition in program level 3 occurred?
>
>What I would like to do in the error handler is switch to the datasession the error occurred in and gather state on open tables/views/record pointers etc...
From what I see in my errorlogs, the on("error") code executes in the datasession in which the error happened, and it's a global handler object just like the one you have.
Not sure, but maybe the debugger knows. I know it shows datasessions switching as the code executes, but if in the call stack you go a few levels back, it should show all the variables and fields as they were... so maybe it switches the DS maybe not. Don't have a ready example at hand, and am too fuzzy with flu to build one - and you seem to have one at hand, so just add a watch on SET("Datasession") in your debugger and see whether it works.