Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-43594

Report invalid IDL types during IDL parsing

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

      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@mongodb.com Mark Benvenuto
            Reporter:
            maria.vankeulen@mongodb.com Maria van Keulen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: