Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/content/docs/ko/basics/astro-pages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ title: '나의 Markdown 페이지'

개발 모드에서 `500.astro` 파일이 있는 경우 런타임에 발생한 오류는 오류 오버레이에 표시되는 것이 아니라 터미널에 기록됩니다.

### `error`

<p><Since v="4.11.0" /></p>

`src/pages/500.astro`는 렌더링 중 발생한 모든 오류에 대해 `error` prop을 자동으로 전달하는 특수 페이지입니다. 이를 통해 오류 세부 정보 (예: 페이지, 미들웨어 등)를 방문자에게 표시할 수 있습니다.

error prop의 데이터 타입은 무엇이든 될 수 있으며, 이는 코드에서 타입을 설정거나 사용하는 방법에 영향을 미칠 수 있습니다.

```astro title="src/pages/500.astro"
---
interface Props {
error: unknown
}
const { error } = Astro.props
---
<div>{error instanceof Error ? error.message : 'Unknown error'}</div>
```

`error` prop의 콘텐츠를 표시할 때 민감한 정보의 유출을 방지하려면 먼저 오류를 평가하고 발생한 오류에 따라 적절한 콘텐츠를 반환하는 것을 고려하세요. 예를 들어 오류 스택에는 코드가 서버에서 어떻게 구성되어 있는지에 대한 정보가 포함되어 있으므로 표시하지 않아야 합니다.

## 부분적 페이지

<p><Since v="3.4.0" /></p>
Expand Down