GH-789 Propagate AWS FunctionInvoker exceptions

They will be handled by the AWS runtime and properly reported and recorded.
Resolves #789
This commit is contained in:
Oleg Zhurakousky
2022-01-12 10:44:29 +01:00
parent 1bdcddef1e
commit b4293878b4
4 changed files with 18 additions and 27 deletions

View File

@@ -49,6 +49,7 @@ import org.springframework.messaging.converter.AbstractMessageConverter;
import org.springframework.util.MimeType;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail;
/**
*
@@ -914,9 +915,14 @@ public class FunctionInvokerTests {
InputStream targetStream = new ByteArrayInputStream(this.apiGatewayEvent.getBytes());
ByteArrayOutputStream output = new ByteArrayOutputStream();
invoker.handleRequest(targetStream, output, null);
Map result = mapper.readValue(output.toByteArray(), Map.class);
assertThat(((String) result.get("body"))).startsWith("Failed to establish route, since neither were provided:");
try {
invoker.handleRequest(targetStream, output, null);
fail();
}
catch (Exception e) {
// TODO: handle exception
}
}
@SuppressWarnings("rawtypes")