Package com.mongodb

Enum Class ErrorCategory

java.lang.Object
java.lang.Enum<ErrorCategory>
com.mongodb.ErrorCategory
All Implemented Interfaces:
Serializable, Comparable<ErrorCategory>, java.lang.constant.Constable

public enum ErrorCategory extends Enum<ErrorCategory>
A categorization of errors returned by a MongoDB server command.
Since:
3.0
  • Enum Constant Details

    • UNCATEGORIZED

      public static final ErrorCategory UNCATEGORIZED
      An uncategorized error
    • DUPLICATE_KEY

      public static final ErrorCategory DUPLICATE_KEY
      A duplicate key error
      MongoDB documentation
      Unique Indexes
    • EXECUTION_TIMEOUT

      public static final ErrorCategory EXECUTION_TIMEOUT
      An execution timeout error
      MongoDB documentation
      maxTimeMS
  • Method Details

    • values

      public static ErrorCategory[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ErrorCategory valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromErrorCode

      public static ErrorCategory fromErrorCode(int code)
      Translate an error code into an error category
      Parameters:
      code - the error code
      Returns:
      the error category for the given code