22. Error 페이지 만들기v4

송민경's avatar
Mar 15, 2024
22. Error 페이지 만들기v4

1. Error 코드

  • 400 Bad Request : body 값을 잘못 적었을 때 // 유효성 검사
이 응답은 잘못된 문법으로 인하여 서버가 요청을 이해할 수 없음
  • 401 Unauthorized
비인증(unauthenticated)
클라이언트는 요청한 응답을 받기 위해서는 반드시 스스로를 인증해야 함
  • 403 Forbidden
클라이언트는 콘텐츠에 접근할 권리(권한)가 없음
401과 다른 점은 서버가 클라이언트가 누구인지 알고 있음
  • 404 Not Found
서버는 요청받은 리소스를 찾을 수 없음 / 브라우저에서는 알려지지 않은 URL
API에서 종점은 적절하지만 리소스 자체는 존재하지 않음
서버들은 인증받지 않은 클라이언트로부터 리소스를 숨기기 위하여 이 응답을 403 대신에 전송
  • 500 Internal Server Error
서버가 처리 방법을 모르는 상황이 발생
  • error 코드 모음
 

2. Error 페이지 만들기

  • errors 폴더 만들어 넣기
notion image
{{> /layout/header}} <div class="container my-3"> <h1>Bad Request 400</h1> <hr> <h4>{{msg}}</h4> </div> {{> /layout/footer}}
{{> /layout/header}} <div class="container my-3"> <h1>Unauthorized 401</h1> <hr> <h4>{{msg}}</h4> </div> {{> /layout/footer}}
{{> /layout/header}} <div class="container my-3"> <h1>Forbidden 403</h1> <hr> <h4>{{msg}}</h4> </div> {{> /layout/footer}}
{{> /layout/header}} <div class="container my-3"> <h1>Not Found 404</h1> <hr> <h4>{{msg}}</h4> </div> {{> /layout/footer}}
{{> /layout/header}} <div class="container my-3"> <h1>Server Error 500</h1> <hr> <h4>알 수 없는 오류가 발생 : 관리자에게 문의하세요</h4> </div> {{> /layout/footer}}
 
Share article
RSSPowered by inblog