Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy compiler error handling #5855

Merged
merged 6 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions .changeset/angry-spoons-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Remove legacy compiler error handling
3 changes: 2 additions & 1 deletion packages/astro/src/core/errors/errors-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const AstroErrorData = defineErrors({
UnknownCompilerError: {
title: 'Unknown compiler error.',
code: 1000,
hint: 'This is almost always a problem with the Astro compiler, not your code. Please open an issue at https://astro.build/issues.',
natemoo-re marked this conversation as resolved.
Show resolved Hide resolved
},
// 1xxx and 2xxx codes are reserved for compiler errors and warnings respectively
/**
Expand Down Expand Up @@ -47,7 +48,7 @@ export const AstroErrorData = defineErrors({
* - [Official integrations](https://docs.astro.build/en/guides/integrations-guide/#official-integrations)
* - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#astroclientaddress)
* @description
* The adapter you.'re using unfortunately does not support `Astro.clientAddress`.
* The adapter you're using unfortunately does not support `Astro.clientAddress`.
*/
ClientAddressNotAvailable: {
title: '`Astro.clientAddress` is not available in current adapter.',
Expand Down
26 changes: 0 additions & 26 deletions packages/astro/src/vite-plugin-astro/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,31 +124,5 @@ async function enhanceCompileError({
}
}

// improve compiler errors
if (err.stack && err.stack.includes('wasm-function')) {
const search = new URLSearchParams({
labels: 'compiler',
title: '🐛 BUG: `@astrojs/compiler` panic',
template: '---01-bug-report.yml',
'bug-description': `\`@astrojs/compiler\` encountered an unrecoverable error when compiling the following file.

**${id.replace(fileURLToPath(config.root), '')}**
\`\`\`astro
${source}
\`\`\``,
});
(err as any).url = `https://github.com/withastro/astro/issues/new?${search.toString()}`;
err.message = `Error: Uh oh, the Astro compiler encountered an unrecoverable error!

Please open
a GitHub issue using the link below:
${(err as any).url}`;

if (logging.level !== 'debug') {
// TODO: remove stack replacement when compiler throws better errors
err.stack = ` at ${id}`;
}
}

throw err;
}