-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: JavaScript, Shell, Testing Infrastructure
-
None
-
Fully Compatible
-
TIG 2018-03-12
In the shell, referencing non-existent error codes on the generated ErrorCodes object gives undefined but should throw an error.
During SERVER-31335 it was discovered that a test was calling
assert.writeErrorWithCode(res, ErrorCodes.DocumentFailedValidation)
(link to code). This was a typo, and ErrorCodes.DocumentFailedValidation is undefined. At the time, the assert function assumed a falsey error code meant that any code was okay, so this assertion passed. assert.writeErrorWithCode no longer allows undefined as an error code. But we should still throw if a non-existent error code is referenced.
Per Max's suggestion
I think we'd need to have the Python script generate the ErrorCodes object as a Proxy object and make it error (or abort) if any property is accessed that isn't defined on the ErrorCodes object itself.
- causes
-
SERVER-34536 shell autocomplete is broken for constructors
- Closed