refs #703: log schema metadata lookup failures
This commit is contained in:
@@ -3,6 +3,8 @@ package com.cloudhandson.vpdbackoffice.web;
|
|||||||
import com.cloudhandson.vpdbackoffice.service.AppException;
|
import com.cloudhandson.vpdbackoffice.service.AppException;
|
||||||
import com.cloudhandson.vpdbackoffice.service.SchemaMetadataService;
|
import com.cloudhandson.vpdbackoffice.service.SchemaMetadataService;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -13,6 +15,8 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|||||||
@Controller
|
@Controller
|
||||||
public class SchemaMetadataController {
|
public class SchemaMetadataController {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(SchemaMetadataController.class);
|
||||||
|
|
||||||
private final SchemaMetadataService schemaMetadataService;
|
private final SchemaMetadataService schemaMetadataService;
|
||||||
|
|
||||||
public SchemaMetadataController(SchemaMetadataService schemaMetadataService) {
|
public SchemaMetadataController(SchemaMetadataService schemaMetadataService) {
|
||||||
@@ -27,7 +31,8 @@ public class SchemaMetadataController {
|
|||||||
try {
|
try {
|
||||||
model.addAttribute("metadata", schemaMetadataService.find(selectedKey));
|
model.addAttribute("metadata", schemaMetadataService.find(selectedKey));
|
||||||
} catch (AppException | DataAccessException exception) {
|
} catch (AppException | DataAccessException exception) {
|
||||||
model.addAttribute("errorMessage", safeMessage(exception));
|
log.warn("Schema metadata lookup failed for table key={}", selectedKey, exception);
|
||||||
|
model.addAttribute("errorMessage", readMessage(exception));
|
||||||
}
|
}
|
||||||
return "schema-metadata";
|
return "schema-metadata";
|
||||||
}
|
}
|
||||||
@@ -105,4 +110,10 @@ public class SchemaMetadataController {
|
|||||||
? exception.getMessage()
|
? exception.getMessage()
|
||||||
: "DB 메타데이터를 저장하지 못했습니다. 권한, 식별자, Oracle annotation 문법을 확인하세요.";
|
: "DB 메타데이터를 저장하지 못했습니다. 권한, 식별자, Oracle annotation 문법을 확인하세요.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String readMessage(Exception exception) {
|
||||||
|
return exception instanceof AppException
|
||||||
|
? exception.getMessage()
|
||||||
|
: "DB 메타데이터를 조회하지 못했습니다. SGMP_POC 조회 권한과 대상 테이블 상태를 확인하세요.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user