Reputation: 1200
When response is already partly submitted it is not possible to change headers to indicate that there has been some fatal error nor it is possible to show well formatted error message (it is very dificult to detect what steps needs to be done to fix the markup to create some space for the message). Should there be some javascript which would redirect the page to some good looking error report or create some overlay for it? Should be the page completely generated to buffer and sent only after complete succesfull rendering? Or some other strategy is suitable?This is a general question valid for every web technology, but I'm particularly interested in solution for JSF, Facelets, Webflow software stack.
Upvotes: 1
Views: 113
Reputation: 1628
I believe it is not possible to react properly in every case because you don't know at which position of html output you are. You even may not know if you are in a html document at all, depending on the application.
Exceptions during view rendering should be fatal and rare. Output buffering, which could solve this problem, is not desirable.
You could try to embed some javascript code into the output, maybe to redirect, but the original page could have been a redirection, too. It may be better to emit js code to open a popup/other window which displays a static html page explaining the fatal error and advising the user.
Upvotes: 1