changeset 27516:1c1216182dc1

error: make ParseError inherit from HintException
author timeless <timeless@mozdev.org>
date Wed, 23 Dec 2015 17:39:32 +0000
parents f8142cb77b1e
children c60a9c16ae25
files mercurial/dispatch.py mercurial/error.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Wed Dec 23 17:38:24 2015 +0000
+++ b/mercurial/dispatch.py	Wed Dec 23 17:39:32 2015 +0000
@@ -107,6 +107,8 @@
         return -1
     except error.ParseError as inst:
         _formatparse(ferr.write, inst)
+        if inst.hint:
+            ferr.write(_("(%s)\n") % inst.hint)
         return -1
 
     msg = ' '.join(' ' in a and repr(a) or a for a in req.args)
@@ -202,6 +204,8 @@
                 (inst.args[0], " ".join(inst.args[1])))
     except error.ParseError as inst:
         _formatparse(ui.warn, inst)
+        if inst.hint:
+            ui.warn(_("(%s)\n") % inst.hint)
         return -1
     except error.LockHeld as inst:
         if inst.errno == errno.ETIMEDOUT:
--- a/mercurial/error.py	Wed Dec 23 17:38:24 2015 +0000
+++ b/mercurial/error.py	Wed Dec 23 17:39:32 2015 +0000
@@ -81,7 +81,7 @@
 class OutOfBandError(HintException):
     """Exception raised when a remote repo reports failure"""
 
-class ParseError(Exception):
+class ParseError(HintException):
     """Raised when parsing config files and {rev,file}sets (msg[, pos])"""
 
 class UnknownIdentifier(ParseError):