error로그 추가

This commit is contained in:
cho
2026-02-10 16:48:33 +09:00
parent 52dd48a9b2
commit 349e12f23d
@@ -28,13 +28,12 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class PrettyPrintController {
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
private static final String FALLBACK_ERROR_JSON =
"{ \"error\": true, \"result\": \"occur error building responseMessage.\" }";
private static final String FALLBACK_ERROR_JSON = "{ \"error\": true, \"result\": \"occur error building responseMessage.\" }";
@RequestMapping(value = "/PrettyPrint", method = RequestMethod.POST, consumes = "application/json", produces = "application/json; charset=UTF-8")
@ResponseBody
public ResponseEntity<String> tokenJson(@RequestBody PrettyPrintRequest transFormRequest, HttpServletRequest request,
HttpServletResponse response) {
public ResponseEntity<String> tokenJson(@RequestBody PrettyPrintRequest transFormRequest,
HttpServletRequest request, HttpServletResponse response) {
PrettyPrintResponse prettyPrintResponse = new PrettyPrintResponse();
@@ -42,16 +41,12 @@ public class PrettyPrintController {
String layoutName = getLayoutName(transFormRequest);
String result = Optional.ofNullable(MessageFactory.getFactory().getMessage(layoutName))
.map(message -> {
String result = Optional.ofNullable(MessageFactory.getFactory().getMessage(layoutName)).map(message -> {
message.setData(transFormRequest.getBizData());
return message.toXMLString();
})
.orElseThrow(()-> new IllegalArgumentException("업무 메세지 파싱중 오류"));
}).orElseThrow(() -> new IllegalArgumentException("업무 메세지 파싱중 오류"));
prettyPrintResponse.setResult(result);
String successJson = buildResponseMessage(prettyPrintResponse);
@@ -77,6 +72,7 @@ public class PrettyPrintController {
ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(prettyPrintResponse);
} catch (Exception e) {
logger.error("occur error building responseMessage.", e);
return FALLBACK_ERROR_JSON;
}