Reconsider how state functions return error

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Gone away
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Driver wrappers that support exceptions won't need to return a state value for error, but instead throw an exception, ala

      underylingState = state_function(...))
      if (underlyingState == ERROR) {
         throw ...
      
      return WrappingEnum.fromUnderlyingState(underlyingState);
      

      It may be simpler if state functions return a boolean to indicate error:

      if (!state_function(...))) {
         throw ...
      
      underylingState = get_state ()
      return WrappingEnum.fromUnderlyingState(underlyingState);
      

      Concretely, that would mean changing:

      mongocrypt_encryptor_state_t
      mongocrypt_encryptor_add_ns (mongocrypt_encryptor_t *encryptor, const char *ns);
      

      to

      bool
      mongocrypt_encryptor_add_ns (mongocrypt_encryptor_t *encryptor, const char *ns);
      

            Assignee:
            Kevin Albertson
            Reporter:
            Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: