Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Any way to see the name for partials when they cause an error? #1681

Closed
EyePulp opened this issue Apr 23, 2020 · 0 comments
Closed

Any way to see the name for partials when they cause an error? #1681

EyePulp opened this issue Apr 23, 2020 · 0 comments

Comments

@EyePulp
Copy link

EyePulp commented Apr 23, 2020

Howdy; Long time lurker, first time poster! =) I couldn't find this issue with a number of searches, so I apologize if it's been raised.

I'm using v4.7.6 on the server side, with this roughly for my instantiation:

const handlebars = require('handlebars').create();
handlebars.registerPartial("foo", templateStringFromFile);
handlebars.compile(pageContent, { strict: true });

Using {strict: true } gives me a head's up for missing values, which I want, but I've noticed when a partial is the source of the error, tracing the problem is challenging:

Error {
    column: 24,
    description: undefined,
    endColumn: 40,
    endLineNumber: 8,
    fileName: undefined,
    lineNumber: 8,
    message: '"domain" not defined in undefined - 8:24',
    name: 'Error',
    number: undefined,
  }

Lots of useful information, but still a struggle to track down on more complex sites with lots of partials or generic variables in play.

My question is whether there's a way to trace errors to the particular partial, or whether there's a way to decorate the Error thrown with the name of the partial.

I'm hoping to put some effort into the code seeing if this is a dumb request, but if anyone has some wisdom to share I'd be obliged.

Thanks, and thanks for a fantastic product - I've used it for probably 8 years or more (is that possible?)

@handlebars-lang handlebars-lang locked and limited conversation to collaborators Dec 3, 2021
@jaylinski jaylinski converted this issue into discussion #1777 Dec 3, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants