Skip to content

Commit

Permalink
fix: Error reporting fails on undefined error index (#5539)
Browse files Browse the repository at this point in the history
* fix: Error reporting fails on undefined error index

* fix: add changeset

* Update .changeset/slow-cherries-bake.md

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
  • Loading branch information
JerryWu1234 and natemoo-re authored Dec 8, 2022
1 parent fe0da01 commit 2c836b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/slow-cherries-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Error reporting fails on undefined error index
2 changes: 1 addition & 1 deletion packages/astro/src/core/errors/dev/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const incompatPackageExp = new RegExp(`(${Object.keys(incompatiblePackage
* Useful for consistent reporting regardless of where the error surfaced from.
*/
export function collectErrorMetadata(e: any, rootFolder?: URL | undefined): ErrorWithMetadata {
const err = AggregateError.is(e) ? (e.errors as SSRError[]) : [e as SSRError];
const err = AggregateError.is(e) || Array.isArray((e as any).errors) ? (e.errors as SSRError[]) : [e as SSRError];

err.forEach((error) => {
if (error.stack) {
Expand Down

0 comments on commit 2c836b9

Please sign in to comment.