Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The code path to produce human-readable error messages if addFilter() etc are called on a non-function is throwing #3385

Closed
LeaVerou opened this issue Jul 28, 2024 · 1 comment
Labels

Comments

@LeaVerou
Copy link

(Using 3.0.0.alpha.17)

As part of almost every 11ty config, I have this little snippet:

for (let name in filters) {
	if (typeof filters[name] === "function") {
		config.addFilter(name, filters[name]);
	}
}

Where filters is an import containing multiple util functions.

In the project I’m currently working on, at some point I started getting this error message:

image

I was puzzled. There was no name anywhere! Clicking through to the call stack revealed this:

image

Which made me realize what was happening: I had added some export const to my filters file, and trying to add these as filters was understandably throwing.

It looks like there is already a code path to produce a better error message, but that is throwing.
Fixing it would be a reasonable first step. I’d argue that this is not a reason for complete and total failure either — but I’m going to open another issue for that.

@zachleat
Copy link
Member

Caught the same in the latest alpha, sorry about that! Fixed here 17a065c#diff-ef495efa0b1aa47730f5ecc48482e10c944d1be2a28f386bd234276a488902d6R309 with #3384

Shipping with 3.0.0-alpha.18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants