Skip to content

Commit 7ddf49a

Browse files
committed
cleanup
1 parent 45b5025 commit 7ddf49a

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<packaging>jar</packaging>
88
<name>Postgres Lambda Trigger Demo</name>
99
<properties>
10-
<maven.compiler.source>21</maven.compiler.source>
11-
<maven.compiler.target>21</maven.compiler.target>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
<maven.compiler.release>21</maven.compiler.release>
1212
</properties>
1313

1414
<dependencyManagement>

src/main/java/demo/CloudFormationCustomResource.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
import com.amazonaws.services.lambda.runtime.Context;
88
import com.amazonaws.services.lambda.runtime.events.CloudFormationCustomResourceEvent;
9+
import java.io.IOException;
910
import java.nio.file.Files;
1011
import java.nio.file.Path;
1112
import java.util.LinkedList;
1213
import java.util.Map;
1314
import org.apache.logging.log4j.LogManager;
1415
import org.apache.logging.log4j.Logger;
16+
import org.jooq.exception.DataAccessException;
1517
import org.jooq.impl.DSL;
1618
import software.amazon.lambda.powertools.cloudformation.AbstractCustomResourceHandler;
1719
import software.amazon.lambda.powertools.cloudformation.Response;
@@ -46,7 +48,7 @@ protected Response create(CloudFormationCustomResourceEvent cfcre, Context cntxt
4648
for (var file : sqlFiles) {
4749
try {
4850
dsl.execute(Files.readString(Path.of(task_root, "scripts", file)));
49-
} catch (Exception e) {
51+
} catch (IOException | DataAccessException e) {
5052
log.error("Error processing SQL file " + file, e);
5153
}
5254
}
@@ -60,7 +62,7 @@ protected Response create(CloudFormationCustomResourceEvent cfcre, Context cntxt
6062
.execute();
6163

6264

63-
} catch (Exception e) {
65+
} catch (DataAccessException e) {
6466
log.error("Could Not Process SQL Files", e);
6567
}
6668
return Response.builder()

src/main/java/demo/FrontEnd.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
1010
import org.apache.logging.log4j.LogManager;
1111
import org.apache.logging.log4j.Logger;
12+
import org.jooq.exception.DataAccessException;
1213
import org.jooq.impl.DSL;
1314

1415
/**
@@ -68,7 +69,7 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
6869
return response
6970
.withStatusCode(200)
7071
.withBody(sb.toString());
71-
} catch (Exception e) {
72+
} catch (DataAccessException e) {
7273
log.error("Front End Error", e);
7374
return response
7475
.withBody(e.toString())

0 commit comments

Comments
 (0)