Search in sources :

Example 1 with LambdaFunctionException

use of com.amazonaws.services.lambda.invoke.LambdaFunctionException in project aws-athena-query-federation by awslabs.

the class ExampleMetadataHandlerTest method doGetTableFail.

@Test(expected = LambdaFunctionException.class)
public void doGetTableFail() {
    try {
        logger.info("doGetTableFail - enter");
        GetTableRequest req = new GetTableRequest(IdentityUtil.fakeIdentity(), "queryId", "default", new TableName("lambda", "fake"));
        metadataHandler.doGetTable(allocator, req);
    } catch (Exception ex) {
        logger.info("doGetTableFail: ", ex);
        throw new LambdaFunctionException(ex.getMessage(), false, "repackaged");
    }
}
Also used : GetTableRequest(com.amazonaws.athena.connector.lambda.metadata.GetTableRequest) TableName(com.amazonaws.athena.connector.lambda.domain.TableName) LambdaFunctionException(com.amazonaws.services.lambda.invoke.LambdaFunctionException) LambdaFunctionException(com.amazonaws.services.lambda.invoke.LambdaFunctionException) Test(org.junit.Test)

Example 2 with LambdaFunctionException

use of com.amazonaws.services.lambda.invoke.LambdaFunctionException in project aws-athena-query-federation by awslabs.

the class LambdaFunctionExceptionSerDeTest method deserialize.

@Test
public void deserialize() throws IOException {
    logger.info("deserialize: enter");
    InputStream input = new ByteArrayInputStream(expectedSerDeText.getBytes());
    LambdaFunctionException actual = mapper.readValue(input, LambdaFunctionException.class);
    logger.info("deserialize: deserialized[{}]", actual.toString());
    assertEquals(expected.getType(), actual.getType());
    assertEquals(expected.getMessage(), actual.getMessage());
    assertEquals(expected.getCause(), actual.getCause());
    expected.fillInStackTrace();
    actual.fillInStackTrace();
    assertEquals(expected.getStackTrace().length, actual.getStackTrace().length);
    logger.info("deserialize: exit");
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) LambdaFunctionException(com.amazonaws.services.lambda.invoke.LambdaFunctionException) TypedSerDeTest(com.amazonaws.athena.connector.lambda.serde.TypedSerDeTest) Test(org.junit.Test)

Aggregations

LambdaFunctionException (com.amazonaws.services.lambda.invoke.LambdaFunctionException)2 Test (org.junit.Test)2 TableName (com.amazonaws.athena.connector.lambda.domain.TableName)1 GetTableRequest (com.amazonaws.athena.connector.lambda.metadata.GetTableRequest)1 TypedSerDeTest (com.amazonaws.athena.connector.lambda.serde.TypedSerDeTest)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1