This work is still working in TAJO-1625.

Overview

Tajo is exposed from diverse user mistake and exception cases. We have to let users know the reason, so we should handle exception with clear causes. With this point of view, we should design and implement the exception propagation system. Basically, we separate all exceptions into managed errors or unmanaged errors. Each managed error has a clear reason, and each clear reason has an unique error code. In most cases, the managed errors can be propagated into the end users through the caller APIs. All unmanaged errors do not have clear reason, and they are actually bugs or unexpected cases. In Tajo, we handle them with TajoInternalError.

Tajo also has JDBC exception and SQLException is used in JDBC APIs. The managed exceptions can be transformed into SQLException with proper SQLState codes.

Exception Hierarchy in Tajo

 

Throwable
     |- Exception 
     |      |- TajoException
     |      |          |- 
     |      |          |- UndefinedDatabaseException, UndefinedTableException, ... (Usual Managed Error)
     |      |
     |      |- SQLException (JDBC exception)
     |
     |- RuntimException - TajoRuntimeException
                                  |- TajoInternalError
                                  |- Unexpected Managed Errors 
     

A managed error means that individual error or exception has Tajo error code.

  • TajoException: Recoverable errors and it should be used when we can know or expect the clear cause or user mistake
  • SQLException: All TajoException should be transformed to SQLException when they are passed through JDBC APIs
  • TajoRuntimeException: Unrecoverable and unexpected errors but in the cases that we can know the clear cause. It can be used to wrap TajoException in order to avoid throwing any exception.
    • TajoInternalError: Unrecoverable and unexpected errors. This is usually used for bugs and the cases which cannot be happen.

Error Codes

See the protocol buffer file (https://github.com/hyunsik/tajo/blob/TAJO-1670/tajo-common/src/main/proto/errors.proto)

How to handle Error and Exception

  • TODO

 

  • No labels