Make sure all except statements are no longer empty, should help a lot with debugging.

This commit is contained in:
Storm Dragon
2025-06-20 03:03:43 -04:00
parent 4e193f133f
commit a5ca1d28e8
42 changed files with 223 additions and 194 deletions

View File

@ -10,7 +10,7 @@ initialized = False
try:
import enchant
initialized = True
except:
except Exception as e:
pass
class command():

View File

@ -30,7 +30,7 @@ class command():
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
clipboardFile.write(clipboard)
clipboardFile.close()
os.chmod(clipboardFilePath, 0o666)
os.chmod(clipboardFilePath, 0o644)
self.env['runtime']['outputManager'].presentText(_('clipboard exported to file'), interrupt=True)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('export_clipboard_to_file:run: Filepath:'+ clipboardFile +' trace:' + str(e),debug.debugLevel.ERROR)

View File

@ -19,7 +19,7 @@ class command():
# Check if progress monitoring should be enabled by default from settings
try:
defaultEnabled = self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'progressMonitoring')
except:
except Exception as e:
# If setting doesn't exist, default to False
defaultEnabled = False
self.env['commandBuffer']['progressMonitoring'] = defaultEnabled
@ -201,7 +201,7 @@ class command():
return False
except Exception:
except Exception as e:
# If anything fails, assume it's not a prompt to be safe
return False

View File

@ -10,7 +10,7 @@ initialized = False
try:
import enchant
initialized = True
except:
except Exception as e:
pass
class command():
@ -35,7 +35,7 @@ class command():
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
try:
self.updateSpellLanguage()
except:
except Exception as e:
return
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()

View File

@ -56,7 +56,7 @@ class command():
self.env['runtime']['debug'].writeDebugOut("Found exact prompt match: " + exactMatch, debug.debugLevel.INFO)
self.disableSilence()
return True
except:
except Exception as e:
# Prompt section doesn't exist in settings, skip custom exact matches
pass
@ -68,7 +68,7 @@ class command():
if customPatterns:
customList = [pattern.strip() for pattern in customPatterns.split(',') if pattern.strip()]
promptPatterns.extend(customList)
except:
except Exception as e:
# Prompt section doesn't exist in settings, skip custom patterns
pass

View File

@ -9,7 +9,7 @@ initialized = False
try:
import enchant
initialized = True
except:
except Exception as e:
pass
class command():
@ -36,7 +36,7 @@ class command():
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
try:
self.updateSpellLanguage()
except:
except Exception as e:
return
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()

View File

@ -11,7 +11,7 @@ initialized = False
try:
import enchant
initialized = True
except:
except Exception as e:
pass
class command():
@ -40,7 +40,7 @@ class command():
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
try:
self.updateSpellLanguage()
except:
except Exception as e:
return
# just when horizontal cursor move worddetection is needed
@ -111,17 +111,17 @@ class command():
try:
if os.path.exists("/bin/"+currWord):
return
except:
except Exception as e:
pass
try:
if os.path.exists("/usr/bin/"+currWord):
return
except:
except Exception as e:
pass
try:
if os.path.exists("/sbin/"+currWord):
return
except:
except Exception as e:
pass
if not self.spellChecker.check(currWord):

View File

@ -23,7 +23,7 @@ class command():
for deviceEntry in deviceList:
# dont play sounds for virtual devices
playSound = playSound or not deviceEntry['virtual']
except:
except Exception as e:
playSound = True
if playSound:
if time.time() - self.lastTime > 5:

View File

@ -31,7 +31,7 @@ class command():
self.checkForPrompt(currentLine)
except Exception as e:
# Silently ignore errors to avoid disrupting normal operation
pass
self.env['runtime']['debug'].writeDebugOut('prompt_detector run: Error in prompt detection: ' + str(e), debug.debugLevel.ERROR)
def checkForPrompt(self, text):
"""Check if the current line contains a shell prompt pattern"""
@ -50,7 +50,7 @@ class command():
self.env['runtime']['debug'].writeDebugOut("Found exact prompt match: " + exactMatch, debug.debugLevel.INFO)
self._restoreSpeech()
return True
except:
except Exception as e:
# Prompt section doesn't exist in settings, skip custom exact matches
pass
@ -62,7 +62,7 @@ class command():
if customPatterns:
customList = [pattern.strip() for pattern in customPatterns.split(',') if pattern.strip()]
promptPatterns.extend(customList)
except:
except Exception as e:
# Prompt section doesn't exist in settings, skip custom patterns
pass

View File

@ -27,8 +27,8 @@ class command():
speechDriver = self.env['runtime']['speechDriver']
speechDriver.shutdown()
speechDriver.initialize(self.env)
except:
pass
except Exception as e:
print(f'revert_to_saved speechDriver: Error reinitializing speech driver: {str(e)}')
# Reinitialize sound system with restored settings
if 'soundDriver' in self.env['runtime']:
@ -36,8 +36,8 @@ class command():
soundDriver = self.env['runtime']['soundDriver']
soundDriver.shutdown()
soundDriver.initialize(self.env)
except:
pass
except Exception as e:
print(f'revert_to_saved soundDriver: Error reinitializing sound driver: {str(e)}')
self.env['runtime']['outputManager'].presentText("Successfully reverted to saved settings", interrupt=False, flush=False)
self.env['runtime']['outputManager'].presentText("All temporary changes have been discarded", interrupt=False, flush=False)

View File

@ -38,7 +38,7 @@ class command():
runtimeValue = runtimeSettings[section][option]
try:
fileValue = fileConfig[section][option]
except:
except Exception as e:
fileValue = ""
if runtimeValue != fileValue:

View File

@ -17,7 +17,7 @@ class command():
try:
# Get current pitch
currentPitch = float(self.env['runtime']['settingsManager'].getSetting('speech', 'pitch'))
except:
except Exception as e:
currentPitch = 0.5
# Present current pitch

View File

@ -17,7 +17,7 @@ class command():
try:
# Get current rate
currentRate = float(self.env['runtime']['settingsManager'].getSetting('speech', 'rate'))
except:
except Exception as e:
currentRate = 0.5
# Present current rate

View File

@ -18,7 +18,7 @@ class command():
# Get current rate from runtime settings (may be temporary)
settingsManager = self.env['runtime']['settingsManager']
currentRate = float(settingsManager.getSetting('speech', 'rate'))
except:
except Exception as e:
currentRate = 0.5
# Present current rate
@ -38,8 +38,8 @@ class command():
if 'speechDriver' in self.env['runtime']:
try:
self.env['runtime']['speechDriver'].setRate(newRate)
except:
pass
except Exception as e:
print(f'adjust_speech_rate setRate: Error setting speech rate: {str(e)}')
newPercent = int(newRate * 100)
self.env['runtime']['outputManager'].presentText(f"Speech rate temporarily set to {newPercent} percent", interrupt=False, flush=False)

View File

@ -17,7 +17,7 @@ class command():
try:
# Get current volume
currentVolume = float(self.env['runtime']['settingsManager'].getSetting('speech', 'volume'))
except:
except Exception as e:
currentVolume = 1.0
# Present current volume

View File

@ -38,19 +38,19 @@ class command():
try:
ratePercent = int(float(rate) * 100)
self.env['runtime']['outputManager'].presentText(f"Rate: {ratePercent} percent", interrupt=True)
except:
except Exception as e:
self.env['runtime']['outputManager'].presentText(f"Rate: {rate}", interrupt=True)
try:
pitchPercent = int(float(pitch) * 100)
self.env['runtime']['outputManager'].presentText(f"Pitch: {pitchPercent} percent", interrupt=True)
except:
except Exception as e:
self.env['runtime']['outputManager'].presentText(f"Pitch: {pitch}", interrupt=True)
try:
volumePercent = int(float(volume) * 100)
self.env['runtime']['outputManager'].presentText(f"Volume: {volumePercent} percent", interrupt=True)
except:
except Exception as e:
self.env['runtime']['outputManager'].presentText(f"Volume: {volume}", interrupt=True)
self.env['runtime']['outputManager'].playSound('Accept')