Projects‎ > ‎XForms‎ > ‎

Better error handling for replace="all" submission

This is implemented as of 2011-08-10.

Scenarios

  1. use of replace="all" to produce final content (form initialization of Ajax)
  2. use of replace="all" during form initialization to produce XML to use in pipeline
In both cases, this is achieved by using a response created with XFormsToXHTML.getResponse().

Currently, status / error handling does not work correctly in both cases. This is problematic for Form Runner, which sometimes is unable to propagate error conditions, in particular with the persistence layer.

Proposal

For scenario #1, the following could work:
  • code set with setStatus() must be passed to the binary document produced, e.g. <document status-code="404">
  • setStatus() even with non-success code does not interrupt processing
  • serializer will have access to document body as well if provided
  • HTTP serializer must read and use @status-code
But for scenario #2, it would be better if the oxf:xforms-to-xhtml processor itself was throwing. However, there is currently not a way to easily tell the 2 scenarios apart.

So here is a mechanism that would work:
  • with replace="all", non-success setStatus() is recorded when it occurs, but response is still written out
  • upon returning from writing the response, if non-success status, dispatch xforms-submit-error
  • then handler can decide itself to throw, e.g. w/ sendError()
  • if error is buffered, like when writing out in a pipeline, then sendError() has expected result

Comments