Skip to content

Commit

Permalink
new error messages and hints
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott committed Oct 20, 2023
1 parent 6b5fecc commit c065375
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/astro/src/core/errors/errors-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,9 +802,9 @@ export const LocalsNotAnObject = {
*/
export const LocalImageUsedWrongly = {
name: 'LocalImageUsedWrongly',
title: 'Local image "src" value not supported.',
title: 'Local image "src" string value not supported.',
message: (imageFilePath: string) =>
`Image "src" value not supported. Local images must be imported with the ESM "import" keyword or the "image()" schema helper in a content collection. Received "${imageFilePath}".`,
`Local image "src" string value not supported. Received ${JSON.stringify(imageFilePath)}. Local images must use the ESM "import" keyword or the "image()" schema helper in content collection frontmatter.`,
} satisfies ErrorData;

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ function formatErrorStackTrace(err: Error | ErrorWithMetadata, isBrowserAvailabl
const prettyLocation = ` at ${errorId?? errorLoc?.file}${
errorLoc?.line && errorLoc.column ? `:${errorLoc.line}:${errorLoc.column}` : ''
}`;
return prettyLocation + '\n [...] See full stack trace in the browser window.';
return prettyLocation + '\n [...] See full stack trace in the browser.';
} else {
return stackLines.join('\n');
}
}
// If the error occurred inside of a dependency, grab the entire stack.
// Otherwise, only grab the part of the stack that is relevant to the user's codebase.
return stackLines.splice(0, irrelevantStackIndex).join('\n') + '\n [...] See full stack trace in the browser window.';
return stackLines.splice(0, irrelevantStackIndex).join('\n') + '\n [...] See full stack trace in the browser.';
}

export function formatErrorMessage(err: ErrorWithMetadata, isBrowserAvailable = false): string {
Expand Down

0 comments on commit c065375

Please sign in to comment.