Skip to content

Commit

Permalink
Provide an error message when Actions throws in setup (#11886)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
matthewp and delucis authored Sep 3, 2024
1 parent f696051 commit 7ff7134
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/many-turtles-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a missing error message when actions throws during `astro sync`
1 change: 1 addition & 0 deletions packages/astro/src/core/logger/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type LoggerLabel =
| 'middleware'
| 'preferences'
| 'redirects'
| 'sync'
| 'toolbar'
| 'assets'
| 'env'
Expand Down
14 changes: 13 additions & 1 deletion packages/astro/src/core/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

Expand Down

0 comments on commit 7ff7134

Please sign in to comment.