mercurial/error.py
changeset 45894 9dc1351d0b5f
parent 45891 da178b816812
child 45903 64faa55716f4
--- a/mercurial/error.py	Mon Nov 16 10:56:54 2020 -0800
+++ b/mercurial/error.py	Fri Nov 20 14:43:21 2020 -0800
@@ -227,6 +227,24 @@
 class ConfigError(Abort):
     """Exception raised when parsing config files"""
 
+    def __init__(self, message, location=None, hint=None):
+        super(ConfigError, self).__init__(message, hint=hint)
+        self.location = location
+
+    def format(self):
+        from .i18n import _
+
+        if self.location is not None:
+            message = _(b"config error at %s: %s\n") % (
+                pycompat.bytestr(self.location),
+                self.message,
+            )
+        else:
+            message = _(b"config error: %s\n") % self.message
+        if self.hint:
+            message += _(b"(%s)\n") % self.hint
+        return message
+
 
 class UpdateAbort(Abort):
     """Raised when an update is aborted for destination issue"""