From f99c1137f091e4ccaf4ca70631dfabb38a85c280 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 18:13:17 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20format?= =?UTF-8?q?=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/ko/docs/tutorial/handling-errors.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/ko/docs/tutorial/handling-errors.md b/docs/ko/docs/tutorial/handling-errors.md index d9c73ca97..6f85eb3c3 100644 --- a/docs/ko/docs/tutorial/handling-errors.md +++ b/docs/ko/docs/tutorial/handling-errors.md @@ -25,7 +25,7 @@ ### `HTTPException` 임포트 -```Python hl_lines="1" +```Python hl_lines="1" {!../../../docs_src/handling_errors/tutorial001.py!} ``` @@ -41,7 +41,7 @@ 일례로, 클라이언트가 존재하지 않는 항목의 ID를 요청하는 경우, 다음과 같은 방법으로 상태 코드 `404`와 함께 예외 처리를 할 수 있습니다. -```Python hl_lines="11" +```Python hl_lines="11" {!../../../docs_src/handling_errors/tutorial001.py!} ``` @@ -50,7 +50,7 @@ 클라이언트가 `http://example.com/items/foo`(`item_id`가 `"foo"`인 항목)로 요청을 보냈다면, 클라이언트는 HTTP 상태코드 200과 다음과 같은 JSON 응답을 받게 될 것입니다: ```JSON -{ +{ "item": "The Foo Wrestlers" } ``` @@ -58,7 +58,7 @@ 하지만 클라이언트가 `http://example.com/items/bar` (`item_id`가 `"bar"`인 항목 없음)로 요청을 보낸다면, 클라이언트는 HTTP 상태코드 404("찾을 수 없음(not found)" 오류)와 다음의 JSON 응답을 받게 될 것입니다: ```JSON -{ +{ "detail": "Item not found" } ``` @@ -86,13 +86,13 @@ HTTP 오류에 사용자 정의 헤더를 추가하는 것이 유용한 경우 Starlette과 동일한 예외 유틸리티를 사용하여 사용자 정의 예외 처리기를 추가할 수 있습니다. -당신 또는 당신이 사용하는 라이브러리가 사용자 정의 예외인 `UnicornException`을 발생(`raise`) 시키고자 한다고 가정해봅시다. +당신 또는 당신이 사용하는 라이브러리가 사용자 정의 예외인 `UnicornException`을 발생(`raise`) 시키고자 한다고 가정해봅시다. 그리고 당신은 FastAPI를 사용하여 해당 예외를 전역적으로 처리하고자 합니다. `@app.exception_handler()`를 사용하여 사용자 예외를 추가할 수 있습니다: -```Python hl_lines="5-7 13-18 24" +```Python hl_lines="5-7 13-18 24" {!../../../docs_src/handling_errors/tutorial003.py!} ``` @@ -129,7 +129,7 @@ HTTP 오류에 사용자 정의 헤더를 추가하는 것이 유용한 경우 예외 처리기는 `Request`와 예외를 전달받습니다. -```Python hl_lines="2 14-16" +```Python hl_lines="2 14-16" {!../../../docs_src/handling_errors/tutorial004.py!} ``` @@ -179,7 +179,7 @@ path -> item_id 예를 들어, 이 오류들에 대해 JSON 대신 일반 텍스트를 반환하고자 할 수 있습니다: -```Python hl_lines="3-4 9-11 22" +```Python hl_lines="3-4 9-11 22" {!../../../docs_src/handling_errors/tutorial004.py!} ```