-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
kind: string | ||
errors: Record<any, string> | ||
highlight?: any | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Code</th> | ||
<th>Message</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr | ||
v-for="(msg, code) of errors" | ||
:class="{ highlight: highlight === `${kind}-${code}` }" | ||
> | ||
<td :id="`${kind}-${code}`" v-text="code" /> | ||
<td v-text="msg" /> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</template> | ||
|
||
<style scoped> | ||
.highlight { | ||
color: var(--vt-c-yellow-darker); | ||
font-weight: bold; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { defineLoader } from 'vitepress' | ||
import { errorMessages } from 'vue/compiler-sfc' | ||
// @ts-expect-error internal api | ||
import { ErrorTypeStrings } from 'vue' | ||
|
||
function filterEmptyMsg(data: Record<number, string>) { | ||
return Object.fromEntries(Object.entries(data).filter(([_, msg]) => msg)) | ||
} | ||
|
||
export default defineLoader({ | ||
load() { | ||
return { | ||
compiler: filterEmptyMsg(errorMessages), | ||
runtime: filterEmptyMsg(ErrorTypeStrings) | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script setup> | ||
import { ref, onMounted } from 'vue' | ||
import { data } from './errors.data.ts' | ||
import ErrorsTable from './ErrorsTable.vue' | ||
|
||
const highlight = ref() | ||
onMounted(() => { | ||
highlight.value = location.hash.slice(1) | ||
}) | ||
</script> | ||
|
||
# Production Error Code Reference {#error-reference} | ||
|
||
## Runtime Errors {#runtime-errors} | ||
|
||
In production builds, the 3rd argument passed to the following error handler APIs will be a short code instead of the full information string: | ||
|
||
- [`app.config.errorHandler`](/api/application.html#app-config-errorhandler) | ||
- [`onErrorCaptured`](/api/composition-api-lifecycle.html#onerrorcaptured) (Composition API) | ||
- [`errorCaptured`](/api/options-lifecycle.html#errorcaptured) (Options API) | ||
|
||
The following table maps the codes to their original full information strings. | ||
|
||
<ErrorsTable kind="runtime" :errors="data.runtime" :highlight="highlight" /> | ||
|
||
## Compiler Errors {#compiler-errors} | ||
|
||
The following table provides a mapping of the production compiler error codes to their original messages. | ||
|
||
<ErrorsTable kind="compiler" :errors="data.compiler" :highlight="highlight" /> |