Example usage for com.amazonaws.services.glue.model ErrorDetail getErrorCode

List of usage examples for com.amazonaws.services.glue.model ErrorDetail getErrorCode

Introduction

In this page you can find the example usage for com.amazonaws.services.glue.model ErrorDetail getErrorCode.

Prototype


public String getErrorCode() 

Source Link

Document

The code associated with this error.

Usage

From source file:com.facebook.presto.hive.metastore.glue.GlueHiveMetastore.java

License:Apache License

private static void propagatePartitionErrorToPrestoException(String databaseName, String tableName,
        List<PartitionError> partitionErrors) {
    if (partitionErrors != null && !partitionErrors.isEmpty()) {
        ErrorDetail errorDetail = partitionErrors.get(0).getErrorDetail();
        String glueExceptionCode = errorDetail.getErrorCode();

        switch (glueExceptionCode) {
        case "AlreadyExistsException":
            throw new PrestoException(ALREADY_EXISTS, errorDetail.getErrorMessage());
        case "EntityNotFoundException":
            throw new TableNotFoundException(new SchemaTableName(databaseName, tableName),
                    errorDetail.getErrorMessage());
        default:/*from   ww  w . ja  va  2 s. c  o  m*/
            throw new PrestoException(HIVE_METASTORE_ERROR,
                    errorDetail.getErrorCode() + ": " + errorDetail.getErrorMessage());
        }
    }
}