Skip to content

Enhanced error handling with error(True) to raise exception on error [done] #299

Closed
@kensoh

Description

@kensoh

user query from Telegram group chat on function hook error handling - https://t.me/rpa_chat/5886


Thanks for raising this! i open a new issue to explore this - #299

Will take some time, because I maintain the Python version in my personal free time. There are generally 2 ideas, 1 is a function hook. 1 is an option to raise error so that users can do a try-catch design.

For the time being, you can do -

if r.click() and r.type() and etc etc:
    print('SUCCESS')
   # do success actions

if not r.click() and not r.type() and ...:
    print('FAIL')
    # do fail actions

Above works because each function call will return True or False depending on whether it is successful.

You can also split into multiple lines if you want the Python script to be neater -

if r.click() and \
    r.type() and \
    ...:
    print('SUCCESS')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions