Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
9 changes: 2 additions & 7 deletions src/content/docs/zh-cn/reference/error-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/
## Astro 错误

- [**UnknownCompilerError**](/zh-cn/reference/errors/unknown-compiler-error/)<br/>Unknown compiler error.
- [**StaticRedirectNotAvailable**](/zh-cn/reference/errors/static-redirect-not-available/)<br/>`Astro.redirect` is not available in static mode.
- [**ClientAddressNotAvailable**](/zh-cn/reference/errors/client-address-not-available/)<br/>`Astro.clientAddress` is not available in current adapter.
- [**PrerenderClientAddressNotAvailable**](/zh-cn/reference/errors/prerender-client-address-not-available/)<br/>`Astro.clientAddress` cannot be used inside prerendered routes.
- [**StaticClientAddressNotAvailable**](/zh-cn/reference/errors/static-client-address-not-available/)<br/>`Astro.clientAddress` is not available in static mode.
Expand All @@ -22,7 +21,6 @@ githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/
- [**InvalidGetStaticPathParam**](/zh-cn/reference/errors/invalid-get-static-path-param/)<br/>Invalid value returned by a `getStaticPaths` path.
- [**InvalidGetStaticPathsEntry**](/zh-cn/reference/errors/invalid-get-static-paths-entry/)<br/>Invalid entry inside getStaticPath's return value
- [**InvalidGetStaticPathsReturn**](/zh-cn/reference/errors/invalid-get-static-paths-return/)<br/>Invalid value returned by getStaticPaths.
- [**GetStaticPathsRemovedRSSHelper**](/zh-cn/reference/errors/get-static-paths-removed-rsshelper/)<br/>getStaticPaths RSS helper is not available anymore.
- [**GetStaticPathsExpectedParams**](/zh-cn/reference/errors/get-static-paths-expected-params/)<br/>Missing params property on `getStaticPaths` route.
- [**GetStaticPathsInvalidRouteParam**](/zh-cn/reference/errors/get-static-paths-invalid-route-param/)<br/>Invalid value for `getStaticPaths` route parameter.
- [**GetStaticPathsRequired**](/zh-cn/reference/errors/get-static-paths-required/)<br/>`getStaticPaths()` function required for dynamic routes.
Expand All @@ -45,7 +43,6 @@ githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/
- [**IncompatibleDescriptorOptions**](/zh-cn/reference/errors/incompatible-descriptor-options/)<br/>Cannot set both `densities` and `widths`
- [**ImageNotFound**](/zh-cn/reference/errors/image-not-found/)<br/>Image not found.
- [**NoImageMetadata**](/zh-cn/reference/errors/no-image-metadata/)<br/>Could not process image metadata.
- [**MarkdownImageNotFound**](/zh-cn/reference/errors/markdown-image-not-found/)<br/>Image not found.
- [**CouldNotTransformImage**](/zh-cn/reference/errors/could-not-transform-image/)<br/>Could not transform image.
- [**ResponseSentError**](/zh-cn/reference/errors/response-sent-error/)<br/>Unable to set response.
- [**MiddlewareNoDataOrNextCalled**](/zh-cn/reference/errors/middleware-no-data-or-next-called/)<br/>The middleware didn't return a `Response`.
Expand All @@ -69,7 +66,6 @@ githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/
- [**IncorrectStrategyForI18n**](/zh-cn/reference/errors/incorrect-strategy-for-i18n/)<br/>You can't use the current function with the current strategy
- [**NoPrerenderedRoutesWithDomains**](/zh-cn/reference/errors/no-prerendered-routes-with-domains/)<br/>Prerendered routes aren't supported when internationalization domains are enabled.
- [**MissingMiddlewareForInternationalization**](/zh-cn/reference/errors/missing-middleware-for-internationalization/)<br/>Enabled manual internationalization routing without having a middleware.
- [**RewriteEncounteredAnError**](/zh-cn/reference/errors/rewrite-encountered-an-error/)<br/>Astro couldn't find the route to rewrite, or if was found but it emitted an error during the rendering phase.
- [**CantRenderPage**](/zh-cn/reference/errors/cant-render-page/)<br/>Astro can't render the route.
- [**UnhandledRejection**](/zh-cn/reference/errors/unhandled-rejection/)<br/>Unhandled rejection
- [**i18nNotEnabled**](/zh-cn/reference/errors/i18n-not-enabled/)<br/>i18n Not Enabled
Expand Down Expand Up @@ -105,7 +101,6 @@ githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/
- [**InvalidContentEntryFrontmatterError**](/zh-cn/reference/errors/invalid-content-entry-frontmatter-error/)<br/>Content entry frontmatter does not match schema.
- [**InvalidContentEntrySlugError**](/zh-cn/reference/errors/invalid-content-entry-slug-error/)<br/>Invalid content entry slug.
- [**ContentSchemaContainsSlugError**](/zh-cn/reference/errors/content-schema-contains-slug-error/)<br/>Content Schema should not contain `slug`.
- [**CollectionDoesNotExistError**](/zh-cn/reference/errors/collection-does-not-exist-error/)<br/>Collection does not exist
- [**MixedContentDataCollectionError**](/zh-cn/reference/errors/mixed-content-data-collection-error/)<br/>Content and data cannot be in same collection.
- [**ContentCollectionTypeMismatchError**](/zh-cn/reference/errors/content-collection-type-mismatch-error/)<br/>Collection contains entries of a different type.
- [**DataCollectionEntryParseError**](/zh-cn/reference/errors/data-collection-entry-parse-error/)<br/>Data collection entry failed to parse.
Expand All @@ -115,6 +110,6 @@ githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/
## Action 错误

- [**ActionsWithoutServerOutputError**](/zh-cn/reference/errors/actions-without-server-output-error/)<br/>Actions must be used with server output.
- [**ActionsUsedWithForGetError**](/zh-cn/reference/errors/actions-used-with-for-get-error/)<br/>An invalid Action query string was passed by a form.
- [**ActionQueryStringInvalidError**](/zh-cn/reference/errors/action-query-string-invalid-error/)<br/>An invalid Action query string was passed by a form.
- [**ActionsReturnedInvalidDataError**](/zh-cn/reference/errors/actions-returned-invalid-data-error/)<br/>Action handler returned invalid data.
- [**ActionNotFoundError**](/zh-cn/reference/errors/action-not-found-error/)<br/>Action not found.
- [**ActionCalledFromServerError**](/zh-cn/reference/errors/action-called-from-server-error/)<br/>Action unexpected called from the server.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/
---


> **ActionCalledFromServerError**: 在服务器页面或端点中调用了 action,但没有使用 `Astro.callAction()`。
> **ActionCalledFromServerError**: 在服务器页面或端点中调用了 action,但没有使用 `Astro.callAction()`。该包装器必须用于从服务器代码调用 action。

## 哪里出了问题?

在服务器页面或端点中调用了 action,但没有使用 `Astro.callAction()`。

**另请参阅:**
- [`Astro.callAction()` 参考](/zh-cn/reference/api-reference/#astrocallaction)
10 changes: 10 additions & 0 deletions src/content/docs/zh-cn/reference/errors/action-not-found-error.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Action not found.
i18nReady: true
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

> **ActionNotFoundError**: 服务器接收到一个名为 `ACTION_NAME` 的 action 请求,但找不到匹配项。如果你重命名了 action,请检查你是否已经更新为匹配的 `actions/index` 文件和调用代码。

## 哪里出了问题?
服务器接收到了 action 的请求,但是无法找到同名的匹配项。
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ i18nReady: true
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

:::caution[已废弃]
此错误来自旧版本的 Astro,已不再使用。如果你无法将项目升级到新版本,那么你可以查阅 [未维护的旧文档快照](/zh-cn/upgrade-astro/#旧版本文档不再维护) 以获取帮助。
:::

> **ActionQueryStringInvalidError**: 服务器收到查询字符串 `?_astroAction=ACTION_NAME`,但找不到具有该名称的 action。如果你在开发过程中更改了 action 的名称,请从 URL 中删除此查询参数并刷新。

## 哪里出了问题?
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Action handler returned invalid data.
i18nReady: true
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

> **ActionsReturnedInvalidDataError**: Action handler 返回了无效数据。handler 应该返回可序列化的数据类型,例如对象、数组、字符串和数字。解析错误:**错误**

## 哪里出了问题?
Action handler 返回了无效数据。handler 应该返回可序列化的数据类型,并且不能返回 Response 对象。

**另请参阅:**
- [Actions handler 参考](/zh-cn/reference/api-reference/#handler-属性)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ i18nReady: true
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

:::caution[已废弃]
此错误来自旧版本的 Astro,已不再使用。如果你无法将项目升级到新版本,那么你可以查阅 [未维护的旧文档快照](/zh-cn/upgrade-astro/#旧版本文档不再维护) 以获取帮助。
:::

> **EnvInvalidVariable**: 以下环境变量与 `experimental.env.schema` 中定义的数据类型和/或属性不匹配:KEY 不是 TYPE 类型

## 发生了什么错误?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ i18nReady: true
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

:::caution[已废弃]
此错误来自旧版本的 Astro,已不再使用。如果你无法将项目升级到新版本,那么你可以查阅 [未维护的旧文档快照](/zh-cn/upgrade-astro/#旧版本文档不再维护) 以获取帮助。
:::

> **InvalidRewrite404**: 只有在按需页面中才允许重写 404。

## 发生了什么错误?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ i18nReady: true
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

:::caution[已废弃]
此错误来自旧版本的 Astro,已不再使用。如果你无法将项目升级到新版本,那么你可以查阅 [未维护的旧文档快照](/zh-cn/upgrade-astro/#旧版本文档不再维护) 以获取帮助。
:::

> **LocalsNotSerializable**:在路径 "`HREF`" 下存储的 `Astro.locals` 中的信息不可序列化。请确保只存储可序列化的数据。(E03034)

## 哪里发生了错误?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ i18nReady: true
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

:::caution[已废弃]
此错误来自旧版本的 Astro,已不再使用。如果你无法将项目升级到新版本,那么你可以查阅 [未维护的旧文档快照](/zh-cn/upgrade-astro/#旧版本文档不再维护) 以获取帮助。
:::

> **错误信息示例:**<br/>
无法解析位于 **blog** → **post.md** 文件中的 frontmatter。<br/>
需要提供 "title" 字段。<br/>
Expand Down