I've set up a server module routine to issue a startsession and a second one to specify Session(*Required). If I call the second routine after a successful start session call it all works fine.
If I remove the startsession call to test what happens if the session is not there I'm getting javascript error
LESERVER.LOADLANGUAGESCENTRES: Invalid Web application session.
While this is correct I expect to receive a Failed event so I can handle it gracefully. Crashing is no good to me. What am I doing wrong.
#LoadLangCentres.ExecuteAsync(...
Evtroutine Handling(#LoadLangCentres.Completed)
...
Evtroutine Handling(#LoadLangCentres.Failed) Reason(#REASON)
Signal Event(LoadLangCentresFailed)
Signal Event(ServerModuleFail) Function("LOADLANGUAGEANDCENTRES") Reason(#REASON)
Endroutine
Server Module Session Handling VLWEB
-
JamesDuignan
- Posts: 85
- Joined: Thu Nov 26, 2015 1:43 pm
Re: Server Module Session Handling VLWEB
Hi Jim,
I suspect that it is still crashing on the failed event is because you have not set the handled selector to true.
Your code should look like the following:
Also you can set a global event for failed requests to the server module using the #SYS_WEB.RequestFailed event.
This will elevate the need to write a new failed event for each call to the servermodule.
Regards,
James Duignan
I suspect that it is still crashing on the failed event is because you have not set the handled selector to true.
Your code should look like the following:
Code: Select all
Evtroutine Handling(#LoadLangCentres.Failed) Reason(#REASON) Handled(#Handled)
#Handled := True
Signal Event(LoadLangCentresFailed)
Signal Event(ServerModuleFail) Function("LOADLANGUAGEANDCENTRES") Reason(#REASON)
Endroutine
This will elevate the need to write a new failed event for each call to the servermodule.
Code: Select all
Evtroutine Handling(#SYS_WEB.RequestFailed) Handled(#Handled) Reason(#Reason) Request(#Request)
#Handled := True
#SYS_WEB.Alert( #Reason )
Endroutine
Regards,
James Duignan
Re: Server Module Session Handling VLWEB
Thanks James.