Uploaded image for project: 'Libmongocrypt'
  1. Libmongocrypt
  2. MONGOCRYPT-135

Reconsider how state functions return error

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Gone away
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None

    Description

      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);
      

      Attachments

        Activity

          People

            kevin.albertson@mongodb.com Kevin Albertson
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: