rohan_rege
20th November 2002, 23:30
Hi ,
I am facing a problem catching a error message while exceuting session tfacp1140s000 using stpapi.get.mess.code in my AFS program.

The problem is that when there error is encountered while processing tfacp1140 script ,a error message is generated , and then a call to choice.abort.program is made thus ending the session tfacp1140s000 automatically.

Now when the session is run thru my AFs program , my
stpapi.get.mess.code () returns empty string , instead of the error code tfacps0107 which it shud rightly do , since it was the error message that was generated before the session was aborted.


Any suggestions , why is the AFs not able to catch the error message.


Also i used the stpapi.get.mess.code("tfacp1140s000" , error.mess1) after
stpapi.continue.process("tfacp1140s000" , error.mess2)

i noticed that error.mess2 contains Process is Gone

Is this the reason why the message is lost ?

Is there a way to get around this problem

Rgds
Rohan

mark_h
23rd November 2002, 00:29
Hi Rohan!

I missed this post, but yes I do think that is why you are not getting the error message. Once the session is killed I believe you get the "Process is gone" message. I had a problem like this in one function server, but not quite as bad. The only solution I found was to test for the error condition before calling the Baan session. So I trapped the error and handled it myself. I am not sure if this will work for you or not.

The only other way to get around the problem would require the source code to eliminate the choice.abort.program, and if I recall correctly you do not have the source.


Mark

rohan_rege
23rd November 2002, 01:29
ya , mark!

As u rightly said , I get the Process is gone message .

I dont have access to the source code , but i can ask the client's baan support partner to make the changes .

in fact , i got in touch with them and then they looked at the source code , but the problem is that choice.abort.program
does some processing (resetting some values ) in the before.choice , so we cant remove that section.

actually , tfacp1140s000 sessions prog script tfacp1140 makes a function call to itfacp0015 .In this function depending upon different errors , choice.abort.program of tfacp1140 gets called from many places from within this function.

So I tried to set a long variable api.error.message in
choice.abort. of tfacp1140, and then export it from there
using export("api.error.message " ,api.error.message )

And then included a
import("api.error.message" , api.error.message ) ,
in my API/AFS program


But though the variable gets set in tfacp1140 , it is never imported into my API/AFS program.

:-((

Is this a right way of trying out ....is this a right direction .???
Am i going wrong somewhere wrt import , export stmts ?

Do u think the above idea might work with some modifications?


I am totally out of ideas now.



Please try and help if u can .

Rgds
Rohan

mark_h
23rd November 2002, 17:14
I think you are going in the correct direction. The export and import are a good idea. I will have to look and see how I do this when I get to work on monday. I would expect this to work.

Mark

Paul P
29th November 2002, 07:49
Dear all,

So my observation that stpapi.get.mess.code() is not always accurate is correct. I've found quite a few situation where the stpapi.* function returns an error message, but the stpapi.get.mess.code() issued right after the command failed to find anything. I had to go to debugger and click on the error message variable name right after the culprit stpapi.* call -- and just before stpapi.get.mess.code() -- to retrieve the actual message.

Rgds,
Paul