Skip to content

Commit

Permalink
make EleventyErrorHandler assign to .originalError instead of `next…
Browse files Browse the repository at this point in the history
…Ref`

and handle cases when `.originalError` is undefined, but `cause` exists
  • Loading branch information
noelforte committed Dec 6, 2024
1 parent c8a7f32 commit e6368f8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Errors/EleventyErrorHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ class EleventyErrorHandler {
while (ref) {
let nextRef = ref.originalError;

// Nunjucks wraps errors and puts the original in error.cause
if (nextRef?.cause?.originalError) {
nextRef = nextRef.cause.originalError;
// Unwrap cause from error and assign it to what Eleventy expects
if (nextRef?.cause) {
nextRef.originalError = nextRef.cause?.originalError || nextRef?.cause;
}

if (!nextRef && EleventyErrorUtil.hasEmbeddedError(ref.message)) {
Expand Down

0 comments on commit e6368f8

Please sign in to comment.