@@ -89,7 +89,7 @@ def getLanguageToUse(mathMl: str = "") -> str:
8989 # ignore regional differences if the MathCAT language setting doesn't have it.
9090 mathCATLanguageSetting = libmathcat .GetPreference ("Language" )
9191 except Exception as e :
92- log .error (e )
92+ log .exception (e )
9393
9494 # log.info(f"getLanguageToUse: {mathCATLanguageSetting}")
9595 if mathCATLanguageSetting != "Auto" :
@@ -118,7 +118,7 @@ def ConvertSSMLTextForNVDA(text: str) -> list:
118118 try :
119119 mathCATLanguageSetting = libmathcat .GetPreference ("Language" )
120120 except Exception as e :
121- log .error (e )
121+ log .exception (e )
122122 language = getLanguageToUse ()
123123 nvdaLanguage = getCurrentLanguage ().replace ("_" , "-" )
124124 # log.info(f"mathCATLanguageSetting={mathCATLanguageSetting}, lang={language}, NVDA={nvdaLanguage}")
@@ -147,7 +147,7 @@ def ConvertSSMLTextForNVDA(text: str) -> list:
147147 try :
148148 libmathcat .SetPreference ("Language" , language )
149149 except Exception as e :
150- log .error (e )
150+ log .exception (e )
151151 language = mathCATLanguageSetting # didn't set the language
152152 if language != nvdaLanguage :
153153 out .append (LangChangeCommand (language ))
@@ -195,7 +195,7 @@ def ConvertSSMLTextForNVDA(text: str) -> list:
195195 try :
196196 libmathcat .SetPreference ("Language" , mathCATLanguageSetting )
197197 except Exception as e :
198- log .error (e )
198+ log .exception (e )
199199 if language != nvdaLanguage :
200200 out .append (LangChangeCommand (None ))
201201 # log.info(f"Speech commands: '{out}'")
@@ -226,7 +226,7 @@ def reportFocus(self):
226226 text = libmathcat .DoNavigateCommand ("ZoomIn" )
227227 speech .speak (ConvertSSMLTextForNVDA (text ))
228228 except Exception as e :
229- log .error (e )
229+ log .exception (e )
230230 # Translators: this message directs users to look in the log file
231231 speech .speakMessage (_ ("Error in starting navigation of math: see NVDA error log for details" ))
232232
@@ -239,7 +239,7 @@ def getBrailleRegions(self, review: bool = False):
239239 try :
240240 region .rawText = libmathcat .GetBraille ("" )
241241 except Exception as e :
242- log .error (e )
242+ log .exception (e )
243243 # Translators: this message directs users to look in the log file
244244 speech .speakMessage (_ ("Error in brailling math: see NVDA error log for details" ))
245245 region .rawText = ""
@@ -294,7 +294,7 @@ def script_navigate(self, gesture: KeyboardInputGesture):
294294 # log.info(f"Navigate speech for {gesture.vkCode}/(s={'shift' in modNames}, c={'control' in modNames}): '{text}'")
295295 speech .speak (ConvertSSMLTextForNVDA (text ))
296296 except Exception as e :
297- log .error (e )
297+ log .exception (e )
298298 # Translators: this message directs users to look in the log file
299299 speech .speakMessage (_ ("Error in navigating math: see NVDA error log for details" ))
300300
@@ -315,7 +315,7 @@ def script_navigate(self, gesture: KeyboardInputGesture):
315315 braille .handler .buffer .update ()
316316 braille .handler .update ()
317317 except Exception as e :
318- log .error (e )
318+ log .exception (e )
319319 # Translators: this message directs users to look in the log file
320320 speech .speakMessage (_ ("Error in brailling math: see NVDA error log for details" ))
321321
@@ -335,7 +335,7 @@ def script_rawdataToClip(self, gesture: KeyboardInputGesture):
335335 try :
336336 copy_as = libmathcat .GetPreference ("CopyAs" ).lower ()
337337 except Exception as e :
338- log .error (f"Not able to get 'CopyAs' preference: { e } " )
338+ log .exception (f"Not able to get 'CopyAs' preference: { e } " )
339339 if copy_as == "asciimath" or copy_as == "latex" :
340340 # save the old braille code, set the new one, get the braille, then reset the code
341341 saved_braille_code : str = libmathcat .GetPreference ("BrailleCode" )
@@ -358,7 +358,7 @@ def script_rawdataToClip(self, gesture: KeyboardInputGesture):
358358 # Translators: copy to clipboard
359359 ui .message (_ ("copy as " ) + copy_as )
360360 except Exception as e :
361- log .error (e )
361+ log .exception (e )
362362 # Translators: this message directs users to look in the log file
363363 speech .speakMessage (_ ("unable to copy math: see NVDA error log for details" ))
364364
@@ -440,7 +440,7 @@ def __init__(self):
440440 libmathcat .SetRulesDir (rules_dir )
441441 libmathcat .SetPreference ("TTS" , "SSML" )
442442 except Exception as e :
443- log .error (e )
443+ log .exception (e )
444444 # Translators: this message directs users to look in the log file
445445 speech .speakMessage (_ ("MathCAT initialization failed: see NVDA error log for details" ))
446446
@@ -452,8 +452,8 @@ def getSpeechForMathMl(self, mathml: str):
452452 libmathcat .SetPreference ("Language" , language )
453453 libmathcat .SetMathML (mathml )
454454 except Exception as e :
455- log .error (e )
456- log .error (f"MathML is { mathml } " )
455+ log .exception (e )
456+ log .exception (f"MathML is { mathml } " )
457457 # Translators: this message directs users to look in the log file
458458 speech .speakMessage (_ ("Illegal MathML found: see NVDA error log for details" ))
459459 libmathcat .SetMathML ("<math></math>" ) # set it to something
@@ -483,7 +483,7 @@ def getSpeechForMathMl(self, mathml: str):
483483 return ConvertSSMLTextForNVDA (libmathcat .GetSpokenText ())
484484
485485 except Exception as e :
486- log .error (e )
486+ log .exception (e )
487487 # Translators: this message directs users to look in the log file
488488 speech .speakMessage (_ ("Error in speaking math: see NVDA error log for details" ))
489489 return ["" ]
@@ -492,23 +492,23 @@ def _add_sounds(self):
492492 try :
493493 return libmathcat .GetPreference ("SpeechSound" ) != "None"
494494 except Exception as e :
495- log .error (f"MathCAT: An exception occurred in _add_sounds: { e } " )
495+ log .exception (f"MathCAT: An exception occurred in _add_sounds: { e } " )
496496 return False
497497
498498 def getBrailleForMathMl (self , mathml : str ):
499499 # log.info("***MathCAT getBrailleForMathMl")
500500 try :
501501 libmathcat .SetMathML (mathml )
502502 except Exception as e :
503- log .error (e )
504- log .error (f"MathML is { mathml } " )
503+ log .exception (e )
504+ log .exception (f"MathML is { mathml } " )
505505 # Translators: this message directs users to look in the log file
506506 speech .speakMessage (_ ("Illegal MathML found: see NVDA error log for details" ))
507507 libmathcat .SetMathML ("<math></math>" ) # set it to something
508508 try :
509509 return libmathcat .GetBraille ("" )
510510 except Exception as e :
511- log .error (e )
511+ log .exception (e )
512512 # Translators: this message directs users to look in the log file
513513 speech .speakMessage (_ ("Error in brailling math: see NVDA error log for details" ))
514514 return ""
@@ -584,7 +584,7 @@ def patched_speak(self, speechSequence: SpeechSequence): # noqa: C901
584584 if item .text :
585585 textList .append (self ._processText (item .text ))
586586 else :
587- log .error ("Unknown speech: %s" % item )
587+ log .exception ("Unknown speech: %s" % item )
588588 # Close any open tags.
589589 if langChanged :
590590 textList .append ("</voice>" )
0 commit comments