# Date 1664509563 -32400
# Fri Sep 30 12:46:03 2022 +0900
# Branch stable
# Node ID 7b9d45a26179fb9541306fdd1ca87ffd3daa411b
# Parent a4093640631fc5c0e0103aefe2058adba9b1b0f1
bugreport: retranslate ConfigError containing location as ParseError
The '#fix' action doesn't work in that case since the ui can't be
instantiated.
diff --git a/tortoisehg/hgqt/qtapp.py b/tortoisehg/hgqt/qtapp.py
--- a/tortoisehg/hgqt/qtapp.py
+++ b/tortoisehg/hgqt/qtapp.py
@@ -112,9 +112,14 @@ def earlyExceptionMsgBox(e):
'values': [hglib.tounicode(str(e))],
'error': traceback.format_exc(),
'nofork': True}
- if isinstance(e, error.ParseError) and e.location:
+ errstring = _recoverableexc[e.__class__]
+ if isinstance(e, error.ConfigError) and e.location:
+ # If ConfigError contained a location, the config file couldn't be
+ # parsed at all. So '#edit:<location>' is the only way to fix.
+ errstring = _recoverableexc[error.ParseError]
opts['values'] += [hglib.tounicode(e.location)]
- errstring = _recoverableexc[e.__class__]
+ elif isinstance(e, error.ParseError) and e.location:
+ opts['values'] += [hglib.tounicode(e.location)]
if not QApplication.instance():
main = QApplication(sys.argv)
dlg = bugreport.ExceptionMsgBox(hglib.tounicode(str(e)), errstring, opts)