Class MongoDbErrorCodes

java.lang.Object
org.springframework.data.mongodb.util.MongoDbErrorCodes

public final class MongoDbErrorCodes extends Object
MongoDbErrorCodes holds MongoDB specific error codes outlined in mongo/base/error_codes.yml.
Since:
1.8
Author:
Christoph Strobl, Mark Paluch, SangHyuk Lee
  • Constructor Details

    • MongoDbErrorCodes

      public MongoDbErrorCodes()
  • Method Details

    • getErrorDescription

      @Nullable public static String getErrorDescription(@Nullable Integer errorCode)
    • isDataIntegrityViolationCode

      public static boolean isDataIntegrityViolationCode(@Nullable Integer errorCode)
    • isDataIntegrityViolationError

      public static boolean isDataIntegrityViolationError(Exception exception)
      Parameters:
      exception - can be null.
      Returns:
      Since:
      4.4
    • isDataAccessResourceFailureCode

      public static boolean isDataAccessResourceFailureCode(@Nullable Integer errorCode)
    • isDataAccessResourceError

      public static boolean isDataAccessResourceError(Exception exception)
      Parameters:
      exception - can be null.
      Returns:
      Since:
      4.4
    • isDuplicateKeyCode

      public static boolean isDuplicateKeyCode(@Nullable Integer errorCode)
    • isDuplicateKeyError

      public static boolean isDuplicateKeyError(Exception exception)
      Parameters:
      exception - can be null.
      Returns:
      Since:
      4.4
    • isDataDuplicateKeyError

      public static boolean isDataDuplicateKeyError(Exception exception)
      Parameters:
      exception - can be null.
      Returns:
      Since:
      4.4
    • isPermissionDeniedCode

      public static boolean isPermissionDeniedCode(@Nullable Integer errorCode)
    • isPermissionDeniedError

      public static boolean isPermissionDeniedError(Exception exception)
      Parameters:
      exception - can be null.
      Returns:
      Since:
      4.4
    • isInvalidDataAccessApiUsageCode

      public static boolean isInvalidDataAccessApiUsageCode(@Nullable Integer errorCode)
    • isInvalidDataAccessApiUsageError

      public static boolean isInvalidDataAccessApiUsageError(Exception exception)
      Parameters:
      exception - can be null.
      Returns:
      Since:
      4.4
    • isClientSessionFailureCode

      public static boolean isClientSessionFailureCode(@Nullable Integer errorCode)
      Check if the given error code matches a know session related error.
      Parameters:
      errorCode - the error code to check.
      Returns:
      true if error matches.
      Since:
      2.1
    • isTransactionFailureCode

      public static boolean isTransactionFailureCode(@Nullable Integer errorCode)
      Check if the given error code matches a know transaction related error.
      Parameters:
      errorCode - the error code to check.
      Returns:
      true if error matches.
      Since:
      2.1
    • isClientSessionFailure

      public static boolean isClientSessionFailure(Exception exception)
      Parameters:
      exception - can be null.
      Returns:
      Since:
      4.4