-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: add guard to if & unless helpers #1549
Conversation
The first time I read it (and without having a look at your issue) I thought it might be breaking, but there are actually no new exception, just different ones. In all sane cases at least. I actually like it. Better error messages are always good.
This change should be generally safe. The only way to be really sure is to apply the change, release it and roll back if someone complains. In my experience, breaking changes usually take less than a week to be noticed. There are some things to consider:
|
@ErisDS despite my things to consider: If you add tests and fix the build, I will merge it. |
87d78d3
to
cd83e2f
Compare
fixes handlebars-lang#1548 - add a guard to show readable syntax error for if / unless helper - prevents against 3 different errors that can be generated by different systax errors
Hey @nknapp, have updated this, adding tests and taking your feedback as far as I was able to for now. What I did first was add a bunch of cases showing these inconsistent error messages for the if, unless and with helpers & commit that. I assume you'll squash this - it's just there to demonstrate the issues. I've switched the logic from I've then added a commit that implements the guards and shows the error messages change to become consistent and hopefully a bit clearer. No other tests have to change for this to pass, so if there are any edge cases they are undocumented and untested. I've not gone as far as a custom Exception class & typings - this is a bit beyond what I'm confident with just now - I'm not familiar with TypeScript. However, I do have other work I'd like to do with error handling, so time-permitting I'll revisit this whole area with some more improvements soooooon. For now, I think this is a small change which offers some improvement 🤞 |
Hi @ErisDS. Thanks for the detailed explanation. I will have a look when I have some time. |
Thank you @ErisDS I would release this in the next minor update, if that's ok. I haven't got a real plan yet about when that will be, but I don't want to release too often anymore unless it is a critical bug. |
Yeah I’m in absolutely no rush 😬 |
This is a small proposed change that adds an error guard. I'm not too sure on wording though, which is basically 90% of the change 😂
Happy to update wording and add tests etc if it's seen as an OK change 👍
fixes #1548