Package com.mongodb

Class MongoException

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TRANSIENT_TRANSACTION_ERROR_LABEL
      Deprecated.
      An error label indicating that the exception can be treated as a transient transaction error.
      static java.lang.String UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
      Deprecated.
      An error label indicating that the exception can be treated as an unknown transaction commit result.
    • Constructor Summary

      Constructors 
      Constructor Description
      MongoException​(int code, java.lang.String msg)
      Deprecated.
       
      MongoException​(int code, java.lang.String msg, java.lang.Throwable t)
      Deprecated.
       
      MongoException​(java.lang.String msg)
      Deprecated.
       
      MongoException​(java.lang.String msg, java.lang.Throwable t)
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addLabel​(java.lang.String errorLabel)
      Deprecated.
      Adds the given error label to the exception.
      static MongoException fromThrowable​(java.lang.Throwable t)
      Deprecated.
      Static helper to create or cast a MongoException from a throwable
      static MongoException fromThrowableNonNull​(java.lang.Throwable t)
      Deprecated.
      Static helper to create or cast a MongoException from a throwable
      int getCode()
      Deprecated.
      Gets the exception code
      java.util.Set<java.lang.String> getErrorLabels()
      Deprecated.
      Gets the set of error labels associated with this exception.
      boolean hasErrorLabel​(java.lang.String errorLabel)
      Deprecated.
      Return true if the exception is labelled with the given error label, and false otherwise.
      void removeLabel​(java.lang.String errorLabel)
      Deprecated.
      Removes the given error label from the exception.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • TRANSIENT_TRANSACTION_ERROR_LABEL

        public static final java.lang.String TRANSIENT_TRANSACTION_ERROR_LABEL
        Deprecated.
        An error label indicating that the exception can be treated as a transient transaction error.
        Since:
        3.8
        See Also:
        hasErrorLabel(String), Constant Field Values
      • UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL

        public static final java.lang.String UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
        Deprecated.
        An error label indicating that the exception can be treated as an unknown transaction commit result.
        Since:
        3.8
        See Also:
        hasErrorLabel(String), Constant Field Values
    • Constructor Detail

      • MongoException

        public MongoException​(java.lang.String msg)
        Deprecated.
        Parameters:
        msg - the message
      • MongoException

        public MongoException​(int code,
                              java.lang.String msg)
        Deprecated.
        Parameters:
        code - the error code
        msg - the message
      • MongoException

        public MongoException​(java.lang.String msg,
                              java.lang.Throwable t)
        Deprecated.
        Parameters:
        msg - the message
        t - the throwable cause
      • MongoException

        public MongoException​(int code,
                              java.lang.String msg,
                              java.lang.Throwable t)
        Deprecated.
        Parameters:
        code - the error code
        msg - the message
        t - the throwable cause
    • Method Detail

      • fromThrowable

        @Nullable
        public static MongoException fromThrowable​(@Nullable
                                                   java.lang.Throwable t)
        Deprecated.
        Static helper to create or cast a MongoException from a throwable
        Parameters:
        t - a throwable, which may be null
        Returns:
        a MongoException
      • fromThrowableNonNull

        public static MongoException fromThrowableNonNull​(java.lang.Throwable t)
        Deprecated.
        Static helper to create or cast a MongoException from a throwable
        Parameters:
        t - a throwable, which may not be null
        Returns:
        a MongoException
        Since:
        3.7
      • getCode

        public int getCode()
        Deprecated.
        Gets the exception code
        Returns:
        the error code.
      • addLabel

        public void addLabel​(java.lang.String errorLabel)
        Deprecated.
        Adds the given error label to the exception.
        Parameters:
        errorLabel - the non-null error label to add to the exception
        Since:
        3.8
      • removeLabel

        public void removeLabel​(java.lang.String errorLabel)
        Deprecated.
        Removes the given error label from the exception.
        Parameters:
        errorLabel - the non-null error label to remove from the exception
        Since:
        3.8
      • getErrorLabels

        public java.util.Set<java.lang.String> getErrorLabels()
        Deprecated.
        Gets the set of error labels associated with this exception.
        Returns:
        the error labels, which may not be null but may be empty
        Since:
        3.8
      • hasErrorLabel

        public boolean hasErrorLabel​(java.lang.String errorLabel)
        Deprecated.
        Return true if the exception is labelled with the given error label, and false otherwise.
        Parameters:
        errorLabel - the non-null error label
        Returns:
        true if the exception is labelled with the given error label
        Since:
        3.8