In the controller I have:
else if (ends-with($exist:resource, ".html")) then
(: the html page is run through view.xql to expand templates :)
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<view>
<forward url="{$exist:controller}/modules/view.xql">
<set-header name="Cache-Control" value="no-cache"/>
</forward>
</view>
<error-handler>
<forward url="{$exist:controller}/error-page.html" method="get"/>
<forward url="{$exist:controller}/modules/view.xql"/>
</error-handler>
</dispatch>
Typically, this helps when a templating function fails (like <div class="app:list-journals"/>
). How to use that for any function failing on the background (e.g. after submission of a form)?
UPDATE
Here is the code where I am trying to catch the error of the templating function:
...
} catch * {
<error>Error {$err:code}: {$err:description}</error>
}
This does not work. The app still uses its own logs as bare XML responses.
Or I would expect this:
...
} catch * {
logger:add-log-message(concat('Error: ', $err:code, $err:description))
}
... could work with some redirecting to a global error page but it does not. As soon as the error is not the problem of the app but, let's say, of a XSLT process, it is not possible to redirect the app to some global page as described in the book by A. Retter (it is necessary to use $EXIST_HOME/webapp/WEB-INF/web.xml
file and there to describe the error and the particular page for redirecting).
More information, no progress.