From fb37051a51c9ceb643ac4e5374fafaaad2196d95 Mon Sep 17 00:00:00 2001 From: Subodh Ranadive Date: Fri, 19 Mar 2021 12:20:15 +0530 Subject: Review resolution --- src/main/java/org/traccar/sms/SnsSmsClient.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/org/traccar/sms/SnsSmsClient.java b/src/main/java/org/traccar/sms/SnsSmsClient.java index d13fb3c34..8a3710ec8 100644 --- a/src/main/java/org/traccar/sms/SnsSmsClient.java +++ b/src/main/java/org/traccar/sms/SnsSmsClient.java @@ -1,5 +1,6 @@ /* * Copyright 2021 Anton Tananaev (anton@traccar.org) + * Copyright 2021 Subodh Ranadive (subodhranadive3103@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,9 +41,7 @@ public class SnsSmsClient implements SmsManager { && Context.getConfig().hasKey(Keys.SMS_AWS_ACCESS) && Context.getConfig().hasKey(Keys.SMS_AWS_SECRET)) { snsClient = awsSNSClient(); - } else { - throw new RuntimeException("SNS Not Configured Properly. Please provide valid config."); - } + } else { throw new RuntimeException("SNS Not Configured Properly. Please provide valid config."); } } public AmazonSNSAsync awsSNSClient() { @@ -59,8 +58,10 @@ public class SnsSmsClient implements SmsManager { new MessageAttributeValue().withStringValue("SNS").withDataType("String")); smsAttributes.put("AWS.SNS.SMS.SMSType", new MessageAttributeValue().withStringValue("Transactional").withDataType("String")); - snsClient.publishAsync(new PublishRequest().withMessage(message) - .withPhoneNumber(destAddress).withMessageAttributes(smsAttributes)); + try { + snsClient.publishAsync(new PublishRequest().withMessage(message) + .withPhoneNumber(destAddress).withMessageAttributes(smsAttributes)); + } catch (Exception exception) { LOGGER.warn("SMS send failed", exception); } } @Override -- cgit v1.2.3