summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2024-09-03 09:45:57 -0400
committerGravatar GitHub <noreply@github.com> 2024-09-03 09:45:57 -0400
commit7ff7134b8038a3b798293b2218bbf6dd02d2ac32 (patch)
tree10115a3fa331c8df430835d1e860594708118022
parentf69605174b067aad3ab5f7c90f8e8228ad4bb2a5 (diff)
downloadastro-7ff7134b8038a3b798293b2218bbf6dd02d2ac32.tar.gz
astro-7ff7134b8038a3b798293b2218bbf6dd02d2ac32.tar.zst
astro-7ff7134b8038a3b798293b2218bbf6dd02d2ac32.zip
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>
-rw-r--r--.changeset/many-turtles-tie.md5
-rw-r--r--packages/astro/src/core/logger/core.ts1
-rw-r--r--packages/astro/src/core/sync/index.ts14
3 files changed, 19 insertions, 1 deletions
diff --git a/.changeset/many-turtles-tie.md b/.changeset/many-turtles-tie.md
new file mode 100644
index 000000000..e98a6c5c7
--- /dev/null
+++ b/.changeset/many-turtles-tie.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes a missing error message when actions throws during `astro sync`
diff --git a/packages/astro/src/core/logger/core.ts b/packages/astro/src/core/logger/core.ts
index 530399ac4..c06866df5 100644
--- a/packages/astro/src/core/logger/core.ts
+++ b/packages/astro/src/core/logger/core.ts
@@ -27,6 +27,7 @@ export type LoggerLabel =
| 'middleware'
| 'preferences'
| 'redirects'
+ | 'sync'
| 'toolbar'
| 'assets'
| 'env'
diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts
index 2a7aa83ce..8b659a4f5 100644
--- a/packages/astro/src/core/sync/index.ts
+++ b/packages/astro/src/core/sync/index.ts
@@ -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 });
}