summaryrefslogtreecommitdiff
path: root/buildscripts/errorcodes.py
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-10-24 13:00:11 -0400
committerMathias Stearn <mathias@10gen.com>2017-11-02 14:25:21 -0400
commitcd26a1d5ee080f1a68b874046e5e5b3672267f69 (patch)
tree44458afc58072d531006fca961f1b0dbcb8d5442 /buildscripts/errorcodes.py
parenta963b8641cf2ab2cd0ccbbde04993a8224dcf52a (diff)
downloadmongo-cd26a1d5ee080f1a68b874046e5e5b3672267f69.tar.gz
SERVER-31629 Support putting unique codes directly into Status constructors
Diffstat (limited to 'buildscripts/errorcodes.py')
-rwxr-xr-xbuildscripts/errorcodes.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/buildscripts/errorcodes.py b/buildscripts/errorcodes.py
index 639c484eeb8..cc46789907f 100755
--- a/buildscripts/errorcodes.py
+++ b/buildscripts/errorcodes.py
@@ -54,17 +54,16 @@ def assignErrorCodes():
def parseSourceFiles( callback ):
"""Walks MongoDB sourcefiles and invokes callback for each AssertLocation found."""
- quick = [ "assert" , "Exception"]
+ quick = ["assert", "Exception", "ErrorCodes::Error"]
patterns = [
re.compile( r"(?:u|m(?:sg)?)asser(?:t|ted)(?:NoTrace)?\s*\(\s*(\d+)", re.MULTILINE ) ,
- re.compile( r"(?:DB|Assertion)Exception\s*\(\s*(\d+)", re.MULTILINE ),
+ re.compile( r"(?:DB|Assertion)Exception\s*[({]\s*(\d+)", re.MULTILINE ),
re.compile( r"fassert(?:Failed)?(?:WithStatus)?(?:NoTrace)?(?:StatusOK)?\s*\(\s*(\d+)",
re.MULTILINE ),
+ re.compile( r"ErrorCodes::Error\s*[({]\s*(\d+)", re.MULTILINE )
]
- bad = [ re.compile( r"^\s*assert *\(" ) ]
-
for sourceFile in utils.getAllSourceFiles(prefix='src/mongo/'):
if list_files:
print 'scanning file: ' + sourceFile
@@ -75,13 +74,6 @@ def parseSourceFiles( callback ):
if not any([zz in text for zz in quick]):
continue
- # TODO: move check for bad assert type to the linter.
- for b in bad:
- if b.search(text):
- msg = "Bare assert prohibited. Replace with [umwdf]assert"
- print( "%s: %s" % (sourceFile, msg) )
- raise Exception(msg)
-
matchiters = [p.finditer(text) for p in patterns]
for matchiter in matchiters:
for match in matchiter: