{"action":"created","issue":{"url":"https://api.github.com/repos/eXistSolutions/hsg-shell/issues/38","labels_url":"https://api.github.com/repos/eXistSolutions/hsg-shell/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/eXistSolutions/hsg-shell/issues/38/comments","events_url":"https://api.github.com/repos/eXistSolutions/hsg-shell/issues/38/events","html_url":"https://github.com/eXistSolutions/hsg-shell/issues/38","id":119545333,"number":38,"title":"app:handle-error not catching templating errors","user":{"login":"joewiz","id":59118,"avatar_url":"https://avatars.githubusercontent.com/u/59118?v=3","gravatar_id":"","url":"https://api.github.com/users/joewiz","html_url":"https://github.com/joewiz","followers_url":"https://api.github.com/users/joewiz/followers","following_url":"https://api.github.com/users/joewiz/following{/other_user}","gists_url":"https://api.github.com/users/joewiz/gists{/gist_id}","starred_url":"https://api.github.com/users/joewiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joewiz/subscriptions","organizations_url":"https://api.github.com/users/joewiz/orgs","repos_url":"https://api.github.com/users/joewiz/repos","events_url":"https://api.github.com/users/joewiz/events{/privacy}","received_events_url":"https://api.github.com/users/joewiz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eXistSolutions/hsg-shell/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/eXistSolutions/hsg-shell/labels/low%20priority","name":"low priority","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-30T17:55:06Z","updated_at":"2015-11-30T18:07:44Z","closed_at":null,"body":"I would expect errors encountered when processing a templating-based page to show error-page.html.  Instead, no error is shown in the resulting page - just a blank body.\r\n\r\nTo reproduce, take a page like `pages/index.html` and change an `@data-template` value to something wrong; for example, change line 11 (as the page looks currently) from:\r\n\r\n    <span data-template=\"app:tweet-html\"/>\r\n\r\nto \r\n\r\n    <span data-template=\"app:tweet-html2\"/> \r\n\r\nThen reload.  You'll get something like this:\r\n\r\n> ![screen shot 2015-11-30 at 12 52 11 pm](https://cloud.githubusercontent.com/assets/59118/11479701/5d26f42a-9761-11e5-811f-815d76f4a699.png)\r\n\r\nThe HTML for the body portion of the page shows this:\r\n\r\n    <div id=\"content\" class=\"container\">\r\n        <div class=\"col-md-12\" data-template=\"app:handle-error\"></div>\r\n        <div class=\"col-md-12\" data-template=\"app:handle-error\" data-template-code=\"404\"></div>\r\n    </div>\r\n\r\nThis appears to come from `pages/error-page.html`, but the divs are strangely empty.  "},"comment":{"url":"https://api.github.com/repos/eXistSolutions/hsg-shell/issues/comments/160709248","html_url":"https://github.com/eXistSolutions/hsg-shell/issues/38#issuecomment-160709248","issue_url":"https://api.github.com/repos/eXistSolutions/hsg-shell/issues/38","id":160709248,"user":{"login":"joewiz","id":59118,"avatar_url":"https://avatars.githubusercontent.com/u/59118?v=3","gravatar_id":"","url":"https://api.github.com/users/joewiz","html_url":"https://github.com/joewiz","followers_url":"https://api.github.com/users/joewiz/followers","following_url":"https://api.github.com/users/joewiz/following{/other_user}","gists_url":"https://api.github.com/users/joewiz/gists{/gist_id}","starred_url":"https://api.github.com/users/joewiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joewiz/subscriptions","organizations_url":"https://api.github.com/users/joewiz/orgs","repos_url":"https://api.github.com/users/joewiz/repos","events_url":"https://api.github.com/users/joewiz/events{/privacy}","received_events_url":"https://api.github.com/users/joewiz/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T18:07:43Z","updated_at":"2015-11-30T18:07:43Z","body":"I think the issue is that the conditional in https://github.com/eXistSolutions/hsg-shell/blob/master/modules/app.xqm#L97-L108 is returning `()` in this case.  If I remove the conditional I see both error messages returned, which is better but not ideal.  It seems to me that a templating error should be treated as a server error 500 with a message like the 1st entry in `pages/error-page.html`: `An error has occurred`.  Ideally, the solution would apply to any page with a templating error, and would also allow the application to still return 404 errors where it deems the request was bad instead of 500 errors for a templating error."}}