Skip to content

Commit 7ff7134

Browse files
matthewpdelucis
andauthoredSep 3, 2024··
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>
1 parent f696051 commit 7ff7134

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed
 

‎.changeset/many-turtles-tie.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes a missing error message when actions throws during `astro sync`

‎packages/astro/src/core/logger/core.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export type LoggerLabel =
2727
| 'middleware'
2828
| 'preferences'
2929
| 'redirects'
30+
| 'sync'
3031
| 'toolbar'
3132
| 'assets'
3233
| 'env'

‎packages/astro/src/core/sync/index.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,19 @@ export default async function sync(
6161
settings,
6262
logger,
6363
});
64-
await runHookConfigDone({ settings, logger });
64+
65+
// Run `astro:config:done`
66+
// Actions will throw if there is misconfiguration, so catch here.
67+
try {
68+
await runHookConfigDone({ settings, logger });
69+
} catch(err) {
70+
if(err instanceof Error) {
71+
const errorMessage = err.toString();
72+
logger.error('sync', errorMessage);
73+
}
74+
throw err;
75+
}
76+
6577
return await syncInternal({ settings, logger, fs, force: inlineConfig.force });
6678
}
6779

0 commit comments

Comments
 (0)
Please sign in to comment.