VLFONE: Using #SYS_WEB.RequestFailed in UF_OEXEC

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
davidbalansa
Posts: 47
Joined: Mon Feb 01, 2016 10:08 am
Location: Australia

VLFONE: Using #SYS_WEB.RequestFailed in UF_OEXEC

Post by davidbalansa » Thu Apr 27, 2017 10:07 am

I would like to capture all server routine failues in a single location. In VL Web, I would put the following event handling routine into my web page, set the #handled := true and process accordingly without having the page crash.
Capture1.JPG
Capture1.JPG (35 KiB) Viewed 2211 times
If I put the same code into my copy of UF_OEXEC and cause the server routine to fail, the code in the event handling routine executes.
Capture3.JPG
Capture3.JPG (16.9 KiB) Viewed 2211 times
But then the page proceeds to crash even though I specify #handled := true. The same code works in a standalone VL Web page.
Capture4.JPG
Capture4.JPG (26.69 KiB) Viewed 2211 times
In VLFONE, is there anything else I need to do after setting #handled := true to stop the VLFONE app from crashing?

Regard,
David

MarkDale
Posts: 102
Joined: Wed Dec 02, 2015 10:06 am

Re: VLFONE: Using #SYS_WEB.RequestFailed in UF_OEXEC

Post by MarkDale » Thu Apr 27, 2017 11:18 am

Hi David,

You can't handle errors that way in VLF-ONE, because VLF-ONE is already internally listening for #SYS_Web.RequestFailed.

VLF-ONE expects that if you have a scenario where you think failure is likely, you will have coded for it as in shipped example DF_T43H1O. (Example Applications --> Advanced --> Handling Errors)

And if you haven't coded for it, it will shut down.

But even if you do code to handle the error, your session with the server is dead (invalid) from then on, so although the user can continue to do things on the client, the next time they try to interact with the server it will fail anyway because the session is invalid. So the best thing to do when handling the error is to shut down gracefully.

davidbalansa
Posts: 47
Joined: Mon Feb 01, 2016 10:08 am
Location: Australia

Re: VLFONE: Using #SYS_WEB.RequestFailed in UF_OEXEC

Post by davidbalansa » Thu Apr 27, 2017 1:32 pm

Hi Mark,

Thank you for the explanation. That makes sense.

One last question. If I do need to handle the error and want to exit gracefully, I see I can use:

#VLF_ONE.uTerminate Possibletocancel(False) Browserisclosing(False)

to display the "You session has ended" message.
Capture5.JPG
Capture5.JPG (21.88 KiB) Viewed 2191 times
Is there a method or technique I can use to send the user back to the login screen?

David

MarkD
Posts: 620
Joined: Wed Dec 02, 2015 9:56 am

Re: VLFONE: Using #SYS_WEB.RequestFailed in UF_OEXEC

Post by MarkD » Thu Apr 27, 2017 1:54 pm

It would be better to stay away from the internals in case they change in the future.
You can switch to the exit command just like any other command.
eg: #avFrameworkManager.avSwitch Caller(#COM_OWNER) Toobjectnamed(VLFONE_DEMONSTRATION) Execute('*EXIT')

MarkD
Posts: 620
Joined: Wed Dec 02, 2015 9:56 am

Re: VLFONE: Using #SYS_WEB.RequestFailed in UF_OEXEC

Post by MarkD » Thu Apr 27, 2017 1:59 pm

Regarding logging on again, #SYS_WEB.URL might be able to be used to navigate to a new tab.

eg:

#SYS_WEB.Navigate Url(#SYS_WEB.URL) Target(New)
#avFrameworkManager.avSwitch Caller(#COM_OWNER) Toobjectnamed(VLFONE_DEMONSTRATION) Execute('*EXIT')

davidbalansa
Posts: 47
Joined: Mon Feb 01, 2016 10:08 am
Location: Australia

Re: VLFONE: Using #SYS_WEB.RequestFailed in UF_OEXEC

Post by davidbalansa » Fri Apr 28, 2017 10:31 am

Hi Mark,

Thank you for the code example!

#SYS_WEB.Navigate Url(#SYS_WEB.URL) Target(New)
#avFrameworkManager.avSwitch Caller(#COM_OWNER) Toobjectnamed(VLFONE_DEMONSTRATION) Execute('*EXIT')

solves my issue.

Thanks,
David

Post Reply