Page 1 of 1

Server Module Session Handling VLWEB

Posted: Tue Jul 10, 2018 11:12 am
by soa
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

Re: Server Module Session Handling VLWEB

Posted: Tue Jul 10, 2018 11:54 am
by JamesDuignan
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:

Code: Select all


Evtroutine Handling(#LoadLangCentres.Failed) Reason(#REASON) Handled(#Handled)

#Handled := True

Signal Event(LoadLangCentresFailed)

Signal Event(ServerModuleFail) Function("LOADLANGUAGEANDCENTRES") Reason(#REASON)

Endroutine


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.

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

Posted: Tue Jul 10, 2018 12:33 pm
by soa
Thanks James.