Package com.mongodb

Class WriteConcernException

    • Constructor Detail

      • WriteConcernException

        public WriteConcernException​(BsonDocument response,
                                     ServerAddress address,
                                     WriteConcernResult writeConcernResult)
        Construct a new instance.
        Parameters:
        response - the response to the write operation
        address - the address of the server that executed the operation
        writeConcernResult - the write concern result
    • Method Detail

      • extractErrorCode

        public static int extractErrorCode​(BsonDocument response)
        For internal use only: extract the error code from the response to a write command.
        Parameters:
        response - the response
        Returns:
        the code, or -1 if there is none
      • extractErrorMessage

        @Nullable
        public static String extractErrorMessage​(BsonDocument response)
        For internal use only: extract the error message from the response to a write command.
        Parameters:
        response - the response
        Returns:
        the error message
      • getWriteConcernResult

        public WriteConcernResult getWriteConcernResult​()
        Gets the write result.
        Returns:
        the write result
      • getErrorCode

        public int getErrorCode​()
        Gets the error code associated with the write concern failure.
        Returns:
        the error code
      • getErrorMessage

        @Nullable
        public String getErrorMessage​()
        Gets the error message associated with the write concern failure.
        Returns:
        the error message
      • getResponse

        public BsonDocument getResponse​()
        Gets the response to the write operation.
        Returns:
        the response to the write operation