Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.mosip.kernel.emailnotification.controller;

import io.mosip.kernel.emailnotification.service.impl.EmailNotificationServiceImpl;
import jakarta.validation.Valid;

import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
Expand All @@ -20,6 +22,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.LoggerFactory;

/**
* This controller class receives contact number and message in data transfer
Expand All @@ -33,6 +36,7 @@
@Tag(name = "smsnotification", description = "Operation related to sms notification")
public class SmsNotificationController {

private static final Logger LOGGER = LoggerFactory.getLogger(SmsNotificationController.class);
/**
* The reference that autowire sms notification service class.
*/
Expand All @@ -57,8 +61,13 @@ public class SmsNotificationController {
public ResponseWrapper<SMSResponseDto> sendSmsNotification(
@Valid @RequestBody RequestWrapper<SmsRequestDto> smsRequestDto) {
ResponseWrapper<SMSResponseDto> responseWrapper = new ResponseWrapper<>();
responseWrapper.setResponse(smsNotifierService.sendSmsNotification(smsRequestDto.getRequest().getNumber(),
smsRequestDto.getRequest().getMessage()));
try {
responseWrapper.setResponse(smsNotifierService.sendSmsNotification(smsRequestDto.getRequest().getNumber(),
smsRequestDto.getRequest().getMessage()));
} catch (Throwable t) {
LOGGER.error("Error occurred while sending SMS notification", t);
throw t;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
return responseWrapper;
}
}