mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
fix: build stuck on unhandled promise reject (#191)
* fix: build stuck on unhandled promise reject * Changeset
This commit is contained in:
parent
e0a4f5fbc0
commit
e0fc2ca097
2 changed files with 13 additions and 2 deletions
5
.changeset/young-mayflies-love.md
Normal file
5
.changeset/young-mayflies-love.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
fix: build stuck on unhandled promise reject
|
|
@ -115,7 +115,8 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
|
|||
scanPromises.push(
|
||||
runtime.load(url).then((result) => {
|
||||
if (result.statusCode !== 200) {
|
||||
throw new Error((result as any).error); // there shouldn’t be a build error here
|
||||
// there shouldn’t be a build error here
|
||||
throw (result as any).error || new Error(`unexpected status ${result.statusCode} when loading ${url}`);
|
||||
}
|
||||
buildState[url] = {
|
||||
srcPath: new URL(url, projectRoot),
|
||||
|
@ -126,7 +127,12 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
|
|||
);
|
||||
}
|
||||
}
|
||||
await Promise.all(scanPromises);
|
||||
try {
|
||||
await Promise.all(scanPromises);
|
||||
} catch (err) {
|
||||
error(logging, 'build', err);
|
||||
return 1;
|
||||
}
|
||||
debug(logging, 'build', `scanned deps [${stopTimer(timer.deps)}]`);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue