com.mysql.cj.exceptions

## Class ExceptionFactory

- java.lang.Object
- - com.mysql.cj.exceptions.ExceptionFactory

    public class ExceptionFactory
    extends Object

### Field Summary

Fields
`private static long` `DEFAULT_WAIT_TIMEOUT_SECONDS`
`private static int` `DUE_TO_TIMEOUT_FALSE`
`private static int` `DUE_TO_TIMEOUT_MAYBE`
`private static int` `DUE_TO_TIMEOUT_TRUE`

### Constructor Summary

Constructors
Constructor and Description
`ExceptionFactory()`

### Method Summary

All Methods Static Methods Concrete Methods
`static CJCommunicationsException` `createCommunicationsException(PropertySet propertySet, ServerSession serverSession, PacketSentTimeHolder packetSentTimeHolder, PacketReceivedTimeHolder packetReceivedTimeHolder, Throwable cause, ExceptionInterceptor interceptor)`
`static <T extends CJException> T` `createException(Class<T> clazz, String message)`
`static <T extends CJException> T` `createException(Class<T> clazz, String message, ExceptionInterceptor interceptor)`
`static <T extends CJException> T` `createException(Class<T> clazz, String message, Throwable cause)`
`static <T extends CJException> T` `createException(Class<T> clazz, String message, Throwable cause, ExceptionInterceptor interceptor)`
`static CJException` `createException(String message)`
`static CJException` `createException(String message, ExceptionInterceptor interceptor)`
`static CJException` `createException(String message, String sqlState, int vendorErrorCode, boolean isTransient, Throwable cause, ExceptionInterceptor interceptor)`
`static CJException` `createException(String message, Throwable cause)`
`static CJException` `createException(String message, Throwable cause, ExceptionInterceptor interceptor)`

`static String`

`createLinkFailureMessageBasedOnHeuristics(PropertySet propertySet, ServerSession serverSession, PacketSentTimeHolder packetSentTimeHolder, PacketReceivedTimeHolder packetReceivedTimeHolder, Throwable underlyingException)`
Creates a communications link failure message to be used in CommunicationsException that (hopefully) has some better information and suggestions based on heuristics.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DEFAULT_WAIT_TIMEOUT_SECONDS

    private static final long DEFAULT_WAIT_TIMEOUT_SECONDS

See Also:
  Constant Field Values

#### DUE_TO_TIMEOUT_FALSE

    private static final int DUE_TO_TIMEOUT_FALSE

See Also:
  Constant Field Values

#### DUE_TO_TIMEOUT_MAYBE

    private static final int DUE_TO_TIMEOUT_MAYBE

See Also:
  Constant Field Values

#### DUE_TO_TIMEOUT_TRUE

    private static final int DUE_TO_TIMEOUT_TRUE

See Also:
  Constant Field Values

### Constructor Detail

#### ExceptionFactory

    public ExceptionFactory()

### Method Detail

#### createException

    public static CJException createException(String message)

#### createException

    public static <T extends CJException> T createException(Class<T> clazz,
                                                            String message)

#### createException

    public static CJException createException(String message,
                                              ExceptionInterceptor interceptor)

#### createException

    public static <T extends CJException> T createException(Class<T> clazz,
                                                            String message,
                                                            ExceptionInterceptor interceptor)

Type Parameters:
  `T` - `CJException`
Parameters:
  `clazz` - exception class
  `message` - message
  `interceptor` - exception interceptor
Returns:
  `CJException` instance

#### createException

    public static CJException createException(String message,
                                              Throwable cause)

#### createException

    public static <T extends CJException> T createException(Class<T> clazz,
                                                            String message,
                                                            Throwable cause)

#### createException

    public static CJException createException(String message,
                                              Throwable cause,
                                              ExceptionInterceptor interceptor)

#### createException

    public static CJException createException(String message,
                                              String sqlState,
                                              int vendorErrorCode,
                                              boolean isTransient,
                                              Throwable cause,
                                              ExceptionInterceptor interceptor)

#### createException

    public static <T extends CJException> T createException(Class<T> clazz,
                                                            String message,
                                                            Throwable cause,
                                                            ExceptionInterceptor interceptor)

Type Parameters:
  `T` - `CJException`
Parameters:
  `clazz` - exception class
  `message` - message
  `cause` - exception caused this one
  `interceptor` - exception interceptor
Returns:
  `CJException` instance

#### createCommunicationsException

    public static CJCommunicationsException createCommunicationsException(PropertySet propertySet,
                                                                          ServerSession serverSession,
                                                                          PacketSentTimeHolder packetSentTimeHolder,
                                                                          PacketReceivedTimeHolder packetReceivedTimeHolder,
                                                                          Throwable cause,
                                                                          ExceptionInterceptor interceptor)

#### createLinkFailureMessageBasedOnHeuristics

    public static String createLinkFailureMessageBasedOnHeuristics(PropertySet propertySet,
                                                                   ServerSession serverSession,
                                                                   PacketSentTimeHolder packetSentTimeHolder,
                                                                   PacketReceivedTimeHolder packetReceivedTimeHolder,
                                                                   Throwable underlyingException)

Creates a communications link failure message to be used in CommunicationsException that (hopefully) has some better information and suggestions based on heuristics.

Parameters:
  `propertySet` - property set
  `serverSession` - server session
  `packetSentTimeHolder` - packetSentTimeHolder
  `packetReceivedTimeHolder` - packetReceivedTimeHolder
  `underlyingException` - underlyingException
Returns:
  message

Copyright © 2016, 2023, Oracle and/or its affiliates.