From d7d88b64f9ec514fcfabdae09cc16d03769ef7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Thu, 7 Sep 2023 22:08:49 +0800 Subject: [PATCH 1/2] refactor(compiler-core): link errors to docs --- packages/compiler-core/src/errors.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compiler-core/src/errors.ts b/packages/compiler-core/src/errors.ts index 36ab783edbe..8883fd15a1f 100644 --- a/packages/compiler-core/src/errors.ts +++ b/packages/compiler-core/src/errors.ts @@ -30,7 +30,7 @@ export function createCompilerError( const msg = __DEV__ || !__BROWSER__ ? (messages || errorMessages)[code] + (additionalMessage || ``) - : code + : `https://vuejs.org/errors/#${code}` const error = new SyntaxError(String(msg)) as InferCompilerError error.code = code error.loc = loc From c261beab2c0a26e401f2c3d5eae2e4c41de6fe4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Thu, 12 Oct 2023 20:54:24 +0800 Subject: [PATCH 2/2] fix: error link --- packages/compiler-core/src/errors.ts | 2 +- packages/runtime-core/src/errorHandling.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/compiler-core/src/errors.ts b/packages/compiler-core/src/errors.ts index 8883fd15a1f..dac779dab54 100644 --- a/packages/compiler-core/src/errors.ts +++ b/packages/compiler-core/src/errors.ts @@ -30,7 +30,7 @@ export function createCompilerError( const msg = __DEV__ || !__BROWSER__ ? (messages || errorMessages)[code] + (additionalMessage || ``) - : `https://vuejs.org/errors/#${code}` + : `https://vuejs.org/errors/#compiler-${code}` const error = new SyntaxError(String(msg)) as InferCompilerError error.code = code error.loc = loc diff --git a/packages/runtime-core/src/errorHandling.ts b/packages/runtime-core/src/errorHandling.ts index afbd226c4c6..f3c03cc9e4f 100644 --- a/packages/runtime-core/src/errorHandling.ts +++ b/packages/runtime-core/src/errorHandling.ts @@ -110,7 +110,9 @@ export function handleError( // the exposed instance is the render proxy to keep it consistent with 2.x const exposedInstance = instance.proxy // in production the hook receives only the error code - const errorInfo = __DEV__ ? ErrorTypeStrings[type] : type + const errorInfo = __DEV__ + ? ErrorTypeStrings[type] + : `https://vuejs.org/errors/#runtime-${type}` while (cur) { const errorCapturedHooks = cur.ec if (errorCapturedHooks) {