org.apache.calcite.avatica

## Class AvaticaSqlException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.sql.SQLException
      - - org.apache.calcite.avatica.AvaticaSqlException

All Implemented Interfaces:
  Serializable, Iterable<Throwable>

    public class AvaticaSqlException
    extends SQLException

A client-facing `SQLException` which encapsulates errors from the remote Avatica server.

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`private static class` `AvaticaSqlException.PrintStreamOrWriter` A class that encapsulates either a PrintStream or a PrintWriter.

### Field Summary

Fields
`private String` `errorMessage`
`private String` `remoteServer`
`private static long` `serialVersionUID`
`private List<String>` `stackTraces`

### Constructor Summary

Constructors
Constructor and Description
`AvaticaSqlException(String errorMessage, String sqlState, int errorCode, List<String> stackTraces, String remoteServer)` Construct the Exception with information from the server.

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `getErrorMessage()`
`String` `getRemoteServer()`
`List<String>` `getStackTraces()`
`(package private) void` `printServerStackTrace(AvaticaSqlException.PrintStreamOrWriter streamOrWriter)`
`void` `printStackTrace(PrintStream stream)`
`void` `printStackTrace(PrintWriter writer)`

### Methods inherited from class java.sql.SQLException

`getErrorCode, getNextException, getSQLState, iterator, setNextException`

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

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace, toString`

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

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

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Field Detail

#### serialVersionUID

    private static final long serialVersionUID

See Also:
  Constant Field Values

#### errorMessage

    private final String errorMessage

#### stackTraces

    private final List<String> stackTraces

#### remoteServer

    private final String remoteServer

### Constructor Detail

#### AvaticaSqlException

    public AvaticaSqlException(String errorMessage,
                               String sqlState,
                               int errorCode,
                               List<String> stackTraces,
                               String remoteServer)

Construct the Exception with information from the server.

Parameters:
  `errorMessage` - A human-readable error message.
  `errorCode` - An integer corresponding to a known error.
  `stackTraces` - Server-side stacktrace.
  `remoteServer` - The host:port where the Avatica server is located

### Method Detail

#### getErrorMessage

    public String getErrorMessage()

#### getStackTraces

    public List<String> getStackTraces()

Returns:
  The stacktraces for exceptions thrown on the Avatica server.

#### getRemoteServer

    public String getRemoteServer()

Returns:
  The host:port for the remote Avatica server. May be null.

#### printStackTrace

    public void printStackTrace(PrintStream stream)

Overrides:
  `printStackTrace` in class `Throwable`

#### printStackTrace

    public void printStackTrace(PrintWriter writer)

Overrides:
  `printStackTrace` in class `Throwable`

#### printServerStackTrace

    void printServerStackTrace(AvaticaSqlException.PrintStreamOrWriter streamOrWriter)