Skip to content

[init] #7 GlobalExceptionHandler 설정#8

Merged
2hyunjinn merged 7 commits intomainfrom
init/#7-exception-setting
Feb 25, 2025
Merged

[init] #7 GlobalExceptionHandler 설정#8
2hyunjinn merged 7 commits intomainfrom
init/#7-exception-setting

Conversation

@2hyunjinn
Copy link
Member

@2hyunjinn 2hyunjinn commented Feb 25, 2025

🛰️ Issue Number

#7

🪐 작업 내용

HTTP 응답코드 메소드 정리

HTTP 응답코드 응답대역 응답코드 설명
100 정보전송임시응답 Continue (클라이언트로부터 일부 요청을 받았으며 나머지 정보를 계속 요청함)
101 정보전송임시응답 Switching protocols
200 성공 OK (요청이 성공적으로 수행되었음)
201 성공 Created (PUT 메소드에 의해 원격지 서버에 파일 생성됨)
202 성공 Accepted (웹 서버가 명령 수신함)
203 성공 Non-authoritative information (서버가 클라이언트 요구 중 일부만 전송)
204 성공 No content (PUT, POST, DELETE 요청의 경우 성공은 했지만 전송할 데이터가 없는 경우)
301 리다이렉션 Moved permanently (요구한 데이터를 변경된 타 URL에 요청함 / Redirect된 경우)
302 리다이렉션 Not temporarily
304 리다이렉션 Not modified (컴퓨터 로컬의 캐시 정보를 이용함, 대개 gif 등은 웹 서버에 요청하지 않음)
400 클라이언트요청에러 Bad Request (사용자의 잘못된 요청을 처리할 수 없음)
401 클라이언트요청에러 Unauthorized (인증이 필요한 페이지를 요청한 경우)
402 클라이언트요청에러 Payment required (예약됨)
403 클라이언트요청에러 Forbidden (접근 금지, 디렉터리 리스팅 요청 및 관리자 페이지 접근 등을 차단)
404 클라이언트요청에러 Not found (요청한 페이지 없음)
405 클라이언트요청에러 Method not allowed (허용되지 않는 HTTP method 사용함)
407 클라이언트요청에러 Proxy authentication required (프락시 인증 요구됨)
408 클라이언트요청에러 Request timeout (요청 시간 초과)
410 클라이언트요청에러 Gone (영구적으로 사용 금지)
412 클라이언트요청에러 Precondition failed (전체 조건 실패)
414 클라이언트요청에러 Request-URI too long (요청 URL 길이가 긴 경우)
500 서버에러 Internal server error (내부 서버 오류)
501 서버에러 Not implemented (웹 서버가 처리할 수 없음)
503 서버에러 Service unavailable (서비스 제공 불가)
504 서버에러 Gateway timeout (게이트웨이 시간 초과)
505 서버에러 HTTP version not supported (해당 HTTP 버전 지원되지 않음)

✅ To-do

  • 200 Success
{
    "status": true,
		"code": 2000,
    "message": "요청이 성공했습니다.",
    "data": null
}
  • 201 Created
{
    "status": true,
		"code": 2010,
    "message": "요청이 성공했습니다.",
    "data": {
        "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNCIsImlhdCI6MTY5MTgyMjc5NywiZXhwIjoxNjkyNDI3NTk3fQ.fOHp7a5TREqBG7wYdkQU65T65-HicArgFANfKbAresQ",
        "refreshToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNCIsImlhdCI6MTY5MTgyMjc5NywiZXhwIjoxNjkyNDI3NTk3fQ.fOHp7a5TREqBG7wYdkQU65T65-HicArgFANfKbAresQ",
				"userId": 1
    }
}
  • 400 Bad Request
{
    "status": false,
		"code": 4000
    "message": "잘못된 요청입니다.",
    "data": null
}

{
    "status": false,
		"code": 4001
    "message": "유효하지 않은 플랫폼 타입입니다.",
    "data": null
}

{
    "status": false,
		"code": 4002
    "message": "요청 파라미터가 잘못되었습니다.",
    "data": null
}
  • 401 Unauthorized
{
	"success": false,
	"code": 4011,
  "message": "액세스 토큰의 값이 올바르지 않습니다.",
	"data": null
}

{
	"success": false,
	"code": 4012,
  "message": "액세스 토큰이 만료되었습니다. 재발급 받아주세요."
	"data": null
}
  • 403 Forbidden
{
    "status": false,
		"code": 4030
    "message": "리소스 접근 권한이 없습니다.",
    "data": null
}
  • 404 Not Found
{
    "status": false,
		"code": 4040
    "message": "대상을 찾을 수 없습니다.",
    "data": null
}

{
    "status": false,
		"code": 4041
    "message": "존재하지 않는 회원입니다.",
    "data": null
}

{
    "status": false,
		"code": 4042
    "message": "존재하지 않는 페스티벌입니다.",
    "data": null
}
  • 405 Method Not Allowed
{
    "status": false,
		"code": 4050
    "message": "잘못된 HTTP method 요청입니다.",
    "data": null
}
  • 409 Conflict
{
    "status": false,
		"code": 4090
    "message": "이미 존재하는 리소스입니다.",
    "data": null
}

{
    "status": false,
		"code": 4091
    "message": "이미 존재하는 회원입니다.",
    "data": null
}

{
    "status": false,
		"code": 4092
    "message": "이미 존재하는 참여자입니다.",
    "data": null
}

{
    "status": false,
		"code": 4093
    "message": "포인트가 부족합니다.",
    "data": null
}
  • 500 Internal Server Error
{
    "status": false,
		"code": 5000
    "message": "서버 내부 오류입니다.",
    "data": null
}

📚 Reference (선택)

🏞 스크린샷 (선택)

closes #7

@github-actions
Copy link

Test Results

1 tests   1 ✅  0s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit ffc8e41.

@2hyunjinn 2hyunjinn self-assigned this Feb 25, 2025
@2hyunjinn 2hyunjinn added the init init label Feb 25, 2025
@2hyunjinn 2hyunjinn merged commit 72799b4 into main Feb 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

init init

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[init] GlobalExceptionHandler 설정

1 participant