Fix corrupted config error (#15691)
Fixes #15690
Summary of the issue:
Critical error when starting NVDA with a corrupted config file.
During config initialization, an error is logged. To check if it should play an error sound, NVDA imports nvwave, which in turn imports nvdaHelper, which imports versionInfo, where "_" is not yet defined since translations are not initialized.
Description of user facing changes
If the configuration file is corrupted, NVDA will not fail starting anymore, but will reinitialize the configuration to default as it did in NVDA 2023.1 and before.
Description of development approach
First I have used buildVersion module in nvdaHelper instead of versionInfo since the latter contains localized information that we do not use. But it was not enough since "_" (underscore is still missing when importing eventHandler or api
Thus, I have implemented an extension point notified when an error is logged and with a handler responsible of playing the error sound. This handler is registered when nvwave audio is iinitialized. More details in Fix corrupted config error #15691 (review).
Also, when investigating the issue and working on this PR, I have fixed the following minor issues:
Removed two lines log.debugWarning("", exc_info=True), and used the exc_info in the log.warning just above. Indeed, during config initialization, log level is not yet known and thus the exc_info information is not known during startup if needed.
Do not provide a write function when loading the config if the config file name is None since it just generates an erronous warning indicating that I am using a read only file system.