Report invalid IDL types during IDL parsing

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: IDL
    • None
    • Security 2019-10-21
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Presently, when a type is passed to IDL that isn't supported in BSON, the following cryptic compiler errors occur:

      src/mongo/idl/server_parameter_with_storage.h:238:15: error: call to deleted member function 'append'
                  b.append(name, getValue());
                  ~~^~~~~~
      src/mongo/idl/server_parameter_with_storage.h:192:5: note: in instantiation of member function 'mongo::IDLServerParameterWithStorage<mongo::ServerParameterType::kStartupOnly, unsigned long long>::append' requested here
          IDLServerParameterWithStorage(StringData name, T& storage)
          ^
      src/mongo/idl/server_parameter_with_storage.h:325:16: note: in instantiation of member function 'mongo::IDLServerParameterWithStorage<mongo::ServerParameterType::kStartupOnly, unsigned long long>::IDLServerParameterWithStorage' requested here
          return new IDLServerParameterWithStorage<paramType, T>(name, storage);
                     ...
      src/mongo/idl/server_parameter_with_storage.h:251:30: error: no matching member function for call to 'coerce'
              if (!newValueElement.coerce(&newValue)) {
                   ~~~~~~~~~~~~~~~~^~~~~~
      

      Instead, we should add a more intuitive error message that mentions that this type isn't supported by BSON. One solution could be to identify these unsupported types at IDL parse time, and output the error there.

              Assignee:
              Mark Benvenuto
              Reporter:
              Maria van Keulen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: