Skip to content

Commit 26973e9

Browse files
committed
capture SNS errors during startup
1 parent 5ab2c3b commit 26973e9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/scorekeep/WebConfig.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import javax.servlet.Filter;
1313
import java.net.URL;
14-
14+
import java.lang.Exception;
1515

1616
import org.slf4j.Logger;
1717
import org.slf4j.LoggerFactory;
@@ -31,16 +31,19 @@ public Filter SimpleCORSFilter() {
3131
}
3232

3333
static {
34-
AWSXRay.beginSegment("Scorekeep");
3534
AWSXRayRecorderBuilder builder = AWSXRayRecorderBuilder.standard().withPlugin(new EC2Plugin()).withPlugin(new ElasticBeanstalkPlugin());
3635

3736
URL ruleFile = WebConfig.class.getResource("/sampling-rules.json");
3837
builder.withSamplingStrategy(new LocalizedSamplingStrategy(ruleFile));
3938

4039
AWSXRay.setGlobalRecorder(builder.build());
4140

41+
AWSXRay.beginSegment("Scorekeep");
4242
if ( System.getenv("NOTIFICATION_EMAIL") != null ){
43-
Utils.createSubscription();
43+
try { Utils.createSubscription(); }
44+
catch (Exception e ) {
45+
logger.warn("Failed to create subscription for email "+ System.getenv("NOTIFICATION_EMAIL"));
46+
}
4447
}
4548

4649
AWSXRay.endSegment();

0 commit comments

Comments
 (0)