I just tried your code IN COM+ and ObjectB Returns an error to ObjectA Even in COM+, so i guess i was wrong, you and Craig were right. I guess My code was wrong in my tests.
But we still have a problem with ComReturnError(), In your code, the error Method returns to the client without cleaning up the LOCAL Var loCom2 and VFP will not clean it up for you so how do we cleanup loCom2 by setting it no NULL from the error method ???
>>Behavior of COM Server Are a bit different in MTS or COM+, They are stateless, meaning as soon as a method is done, is is removed from memory. Maybe there is something wrong with my code but all my tests in COM+ returns the control to the client.
>>
>>Do you have COM+ ? If no, can you post your test code and i'll try it in COM+.
>
>I'd have to re-read Craig's articles to do it on my end, so here's the code below.
>
>Code for Object A:
>
>Define Class ComError1 As Session OlePublic
>
> Procedure CallComError2()
> Local loCom2
> loCom2 = CreateObject("ComError2.ComError2")
> loCom2.CauseError()
> Return "after com2 error"
> Endproc
>
> Procedure Error(nError, cMethod, nLine)
>
> ComReturnError("Error","ComError1")
> Return "Error occurred"
>
> Endproc
>
>Enddefine
>
>
>Code for Object B:
>
>Define Class ComError2 As Session OlePublic
>
> Procedure CauseError()
>
> ComReturnError("Error","ComError2")
> Return "After ComReturnError"
>
> Endproc
>
>Enddefine
>
>
>I instantiated ComError1 from the command window and executed the CallComError2() method. Very simple code, but hopefully it follows the scenario you described. In my tests, I see "ComError1" in the error message. If control returned directly to the client, I would have expected to see "ComError2" in the error message. If this doesn't match your scenario, let me know what I should change, and I'll try it again.