[Sikuli Java API] FindFail VS null pointer

Asked by Francis Jacques

Hi sikuli team !

sikuli script was throwing a findfail exception when no match were found on the screen whereas sikuli API simply returns a null match pointer.

Is there any philosophical/design reason behind this change of behavior ?

Can a flag (to switch between those two behaviors) be considered a new feature ?

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

*** recommendation for issues with Sikuli Java API:
pls. post on
http://code.google.com/p/sikuli-api/issues/list
which is the direct access to the developers.

Revision history for this message
j (j-the-k) said :
#2

Just an addition: In SikuliScript, you can change the fail behaviour with

region.setThrowException(false)

then you have the same behaviour as in sikuli API, null is returned.
I don't remember if the same thing is possible in Sikuli API to switch the exceptions on.

In my opinion the (default) behaviour of find operations was switched to "return null" because this is nicer to handle with one if() instead of a try() catch(), but this is just my guess, I haven't implemented Sikuli API ;-)

Can you help with this problem?

Provide an answer of your own, or ask Francis Jacques for more information if necessary.

To post a message you must log in.