Make compilation errors available to extensions.#33
Conversation
Currently neither template compilation nor rendering occur until after the 'onPreResponse' event. This means that extensions have no way to intercept template related errors. This change moves the compilation step to an earlier point in the request lifecycle so that compilation errors are made available to the 'onPostHandler' and 'onPreResponse' extension points. Rendering still happens after 'onPreResponse' so that the context object can be modified by extensions all the up through the 'onPreResponse' event. Fixes hapijs#10.
|
@arb any chance you have some time to look this over? |
|
I would appreciate it if somebody else from @hapijs/core-project-maintainers could review this before it is merged since it is a non-trivial change. |
|
Looking at the scope of this change, I think you should bump the major version to minimize any potential issues. While the rewrite is to fix what we're calling a bug, this is a lot of code moving around. All the unit tests may pass, but we don't know how this plugin is being used "out there". As far as actual implementation goes, I'm not familiar enough with this plugin to speak intelligently about it. |
|
Makes sense. Thanks for the feedback. |
|
@hueniverse it seems that you may be the only other person familiar with this code. I'd welcome a review from you if you have time. Otherwise, I'm comfortable merging this as is. |
Make compilation errors available to extensions.
|
The name |
|
Fair enough. I tried to think of a different name but didn't manage to come up with one that I liked better. Do you have something in mind that you think works better? I'm happy to change it. |
|
I tend to pick names that describe the stages (prepare, finalize, etc.) |
|
Cool, that makes sense. So would |
|
Sure. |
|
Done. |
|
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Currently neither template compilation nor rendering occur until
after the 'onPreResponse' event. This means that extensions have
no way to intercept template related errors. This change moves the
compilation step to an earlier point in the request lifecycle so
that compilation errors are made available to the 'onPostHandler'
and 'onPreResponse' extension points. Rendering still happens
after 'onPreResponse' so that the context object can be modified
by extensions all the way up through the 'onPreResponse' event.
Fixes #10.