Compare commits
2 Commits
5869b8fe14
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c1bd8197f | |||
| dc74870558 |
@@ -1,5 +1,11 @@
|
|||||||
# 🛠️ Spring Boot Blog API Server
|
# 🛠️ Spring Boot Blog API Server
|
||||||
|
|
||||||
|
## Result
|
||||||
|
|
||||||
|
[**Blog**](https://blog.wypark.me)
|
||||||
|
|
||||||
|
위 링크에서 이 프로젝트의 결과를 보실 수 있습니다.
|
||||||
|
|
||||||
## 🚀 Project Overview
|
## 🚀 Project Overview
|
||||||
기존 **Jekyll(GitHub Pages)** 로 운영하던 정적 블로그의 한계를 극복하고, 확장 가능한 블로그 시스템을 구축하기 위해 개발한 **Spring Boot 기반의 REST API 서버**입니다.
|
기존 **Jekyll(GitHub Pages)** 로 운영하던 정적 블로그의 한계를 극복하고, 확장 가능한 블로그 시스템을 구축하기 위해 개발한 **Spring Boot 기반의 REST API 서버**입니다.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package me.wypark.blogbackend.core.error
|
package me.wypark.blogbackend.core.error
|
||||||
|
|
||||||
import me.wypark.blogbackend.api.common.ApiResponse
|
import me.wypark.blogbackend.api.common.ApiResponse
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.http.HttpStatus
|
import org.springframework.http.HttpStatus
|
||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
import org.springframework.web.bind.MethodArgumentNotValidException
|
import org.springframework.web.bind.MethodArgumentNotValidException
|
||||||
@@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
|
|||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
class GlobalExceptionHandler {
|
class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
private val log = LoggerFactory.getLogger(this.javaClass)!!
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [비즈니스 로직 예외 처리]
|
* [비즈니스 로직 예외 처리]
|
||||||
*
|
*
|
||||||
@@ -58,7 +61,7 @@ class GlobalExceptionHandler {
|
|||||||
*/
|
*/
|
||||||
@ExceptionHandler(Exception::class)
|
@ExceptionHandler(Exception::class)
|
||||||
fun handleException(e: Exception): ResponseEntity<ApiResponse<Nothing>> {
|
fun handleException(e: Exception): ResponseEntity<ApiResponse<Nothing>> {
|
||||||
e.printStackTrace() // 실제 운영 환경에서는 SLF4J 등의 로거를 사용하여 파일/ELK로 수집해야 함
|
log.error("Error occurred: ", e)
|
||||||
return ResponseEntity
|
return ResponseEntity
|
||||||
.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
.body(ApiResponse.error("서버 내부 오류가 발생했습니다."))
|
.body(ApiResponse.error("서버 내부 오류가 발생했습니다."))
|
||||||
|
|||||||
Reference in New Issue
Block a user