[PATCH 3 of 9 sethelp] error: add a new NotAFunction error type

Augie Fackler raf at durin42.com
Wed Feb 4 12:15:08 CST 2015


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1422300661 18000
#      Mon Jan 26 14:31:01 2015 -0500
# Node ID 04c92caf02b761ce3e2f46618b6b93e09e2b1bd3
# Parent  31f51746469a974042b75e32095e20b565bba8f4
error: add a new NotAFunction error type

This will be used by the revset and fileset code to communicate more
specific errors to higher levels so that we might be able to offer
suggestions about what function might have been similar.

diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -63,6 +63,15 @@ class OutOfBandError(Exception):
 class ParseError(Exception):
     """Raised when parsing config files and {rev,file}sets (msg[, pos])"""
 
+class NotAFunction(ParseError):
+    """Exception raised when a {rev,file}set references an unknown function"""
+
+    def __init__(self, function, symbols):
+        from i18n import _
+        ParseError.__init__(self, _("not a function: %s") % function)
+        self.function = function
+        self.symbols = symbols
+
 class RepoError(Exception):
     def __init__(self, *args, **kw):
         Exception.__init__(self, *args)


More information about the Mercurial-devel mailing list