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

Gracefully handle exceptions in UI Automation initialisation #483

Closed
nvaccessAuto opened this issue Jan 1, 2010 · 5 comments
Closed

Gracefully handle exceptions in UI Automation initialisation #483

nvaccessAuto opened this issue Jan 1, 2010 · 5 comments
Assignees
Labels
Milestone

Comments

@nvaccessAuto
Copy link

Reported by jteh on 2009-11-27 05:49
A user reported that NVDA 2009.1 wouldn't start on his system. The log revealed that creating the UI Automation client object threw a "class not registered" error. While this is almost certainly due to brokenness on the system (maybe a broken install of the Platform Update?), UI Automation isn't essential and we can probably get away with just logging an error if it fails to initialise.

There are two ways we can do this (if we choose to do it at all):

  1. Catch any exceptions in UIAHandler.initialize() and log them there; or
  2. Catch exceptions from UIAHandler.initialize() in core.main() and log the error there.
    Personally, I probaby prefer option 2, as initialisation really did fail, so core should know about it. Having said that, initialize() doesn't do anything special if UIA wasn't present, which makes this argument less valid.
@nvaccessAuto
Copy link
Author

Comment 1 by mdcurran on 2009-11-27 06:26
I think I am for a try ... except around UIAHandler.initialize in core.main. Its possible we actually should do the same for java access bridge really. Rather than just pretending it worked.

@nvaccessAuto
Copy link
Author

Comment 2 by jteh on 2009-11-27 06:29
So if UIA really isn't available at all, should it raise an exception too, rather than just pretending it succeeded as it does now? One issue is that UIA failing because of "class not registered" or some such is really an error, whereas it not being available isn't an error. We don't want to log an error in the latter case, but do we want to for the former?

@nvaccessAuto
Copy link
Author

Comment 3 by mdcurran on 2009-11-27 06:33
I assume you think that class not registered is more of an error than the dll just not existing because if the dll exists it should be registered?
I personally think it should also throw an error if the dll does not exist, perhaps NotImplementedError? and make initialization of APIs a little more standard.

@nvaccessAuto
Copy link
Author

Comment 4 by jteh (in reply to comment 3) on 2009-11-27 06:36
Replying to mdcurran:

I assume you think that class not registered is more of an error than the dll just not existing because if the dll exists it should be registered?

Correct.

I personally think it should also throw an error if the dll does not exist, perhaps !NotImplementedError?

That's fine with me. However, the question then is: should we special case !NotImplementedError and not log an error in that case? (Perhaps log info or warning, but not an error.) So, the code would look something like:

try:
 UIAHandler.initialize()
except NotImplementedError:
 log.info("UIA not available")
except:
 log.error("Error initializing UIA", exc_info=True)

@nvaccessAuto
Copy link
Author

Comment 5 by jteh on 2009-11-27 07:57
We're working around broken systems here, but it could still be considered a defect in NVDA.

Fix implemented in r3390.
Changes:
State: closed

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

No branches or pull requests

2 participants