Can we have On Error Resume Next option to resume in errors?

Asked by Farooq Pathan

Hi Guys,

I have made a program for my client which browses some websites, but when it doesn't finds some options it gives very big java errors.

Can i catch error and either show my customized error or i can resume it on any error that is it should never consider errors and go next.

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

You have 3 options:

1 --- use exists()
implement more intervening checks with exists() to assure, that is visible on the screen, what you expect to go on with your workflow, either with appropriate max waiting times or waiting loops. This makes your script more robust.

2 --- catch FindFailed
a similar approach, but you move the recovery to the exception handling. Since this is relatively complex, I generally prefer option 1, because it is better integrated into the workflow.

3 --- use the interactive FindFailed options
When the script stops, you get a prompt and can arrange the affected app, so the script might go on repeating or skipping the failed action. Currently it is not possible, to show additional text, that might help the user.
see: http://sikuli.org/docx/region.html#exception-findfailed
Be aware, that this option is a Region option: it has to be set for every region independently.

Revision history for this message
Farooq Pathan (farooq-pathan) said :
#2

Thanks RaiMan,

While i use exists(), is there any way i can display a user friendly error like "Browser not open" etc... and then exit program?

Secondly,

Is there any way to resume in errors instead of hanging up?

Thanks

Revision history for this message
RaiMan (raimund-hocke) said :
#3

--- While i use exists(), is there any way i can display a user friendly error like "Browser not open" etc... and then exit program?

if not exists(img):
    popup("error message")
    exit(1)

--- Is there any way to resume in errors instead of hanging up?
use the above option 3 (SKIP or RETRY)

Can you help with this problem?

Provide an answer of your own, or ask Farooq Pathan for more information if necessary.

To post a message you must log in.