Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch and don't throw from "toString" methods for IA2 and Atspi #213

Open
spectranaut opened this issue Apr 18, 2024 · 3 comments
Open

Catch and don't throw from "toString" methods for IA2 and Atspi #213

spectranaut opened this issue Apr 18, 2024 · 3 comments

Comments

@spectranaut
Copy link
Contributor

Joanie mentioned wanting to print all the data we could get on a tree, and not stopping if something returns an error.

Maybe the "toString" can print information, and not throw, to be used for this purpose.

@spectranaut
Copy link
Contributor Author

spectranaut commented Apr 18, 2024

For example, when getting some node data on some nodes in libreoffice, we are getting error codes from the IA2 API.

For example, IAAction::toString throws on a menu item:

------> ROLE_SYSTEM_MENUITEM Name='File', Description='',  States=('FOCUSABLE', 'HASPOPUP', 'OPAQUE')
...
  File "C:\Users\spectranaut\repos\AXAccess\build\bin\dump_tree_ia2.py", line 28, in print_tree
    print("  " * level + "* " + action.toString())
                                ^^^^^^^^^^^^^^^^^
  File "C:\Users\spectranaut\repos\AXAccess\build\bin\acacia_ia2.py", line 314, in toString
    return _acacia_ia2_python.IAAction_toString(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: ERROR: get_name failed: E_NOTIMPL

And this failure:

--> IA2_ROLE_ROOT_PANE ROLE_SYSTEM_CLIENT Name='Untitled 1 — LibreOffice Writer', Description='',  States=('FOCUSABLE',)
...
  File "C:\Users\spectranaut\repos\AXAccess\build\bin\dump_tree_ia2.py", line 22, in print_tree
    properties = ia2.toString()
                 ^^^^^^^^^^^^^^
  File "C:\Users\spectranaut\repos\AXAccess\build\bin\acacia_ia2.py", line 280, in toString
    return _acacia_ia2_python.IA2_toString(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: ERROR: get_attributes failed: E_FAIL

@spectranaut
Copy link
Contributor Author

When we encounter an error, we should print it in the string, for example, name=<error>

@spectranaut
Copy link
Contributor Author

It turns out it is very difficult to get Atspi to return an error message, error messages are only returned in special cases. We do get a lot of warnings thrown out to the terminal from these kinds of checks in the Atspi code instead: https://docs.gtk.org/glib/warnings.html

Other places it throws errors (like Orca inspects to see if an object is dead) will usually happening when processing an event queue for objects that no longer exist, which will happen less often in a testing library.

However, I think we do need to do this change in IA2, as it clearly returns errors more often.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant