0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-17 22:44:24 -05:00

Provide an error message when Actions throws in setup (#11886)

* Provide an error message when Actions throws in setup

* Update .changeset/many-turtles-tie.md

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

---------

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
This commit is contained in:
Matthew Phillips 2024-09-03 09:45:57 -04:00 committed by GitHub
parent f69605174b
commit 7ff7134b80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes a missing error message when actions throws during `astro sync`

View file

@ -27,6 +27,7 @@ export type LoggerLabel =
| 'middleware'
| 'preferences'
| 'redirects'
| 'sync'
| 'toolbar'
| 'assets'
| 'env'

View file

@ -61,7 +61,19 @@ export default async function sync(
settings,
logger,
});
await runHookConfigDone({ settings, logger });
// Run `astro:config:done`
// Actions will throw if there is misconfiguration, so catch here.
try {
await runHookConfigDone({ settings, logger });
} catch(err) {
if(err instanceof Error) {
const errorMessage = err.toString();
logger.error('sync', errorMessage);
}
throw err;
}
return await syncInternal({ settings, logger, fs, force: inlineConfig.force });
}