Error propagation is always an issue with XSLT. Transformation will fail, and when they do they either give you a rubbish result or nothing at all. For one-off manual transformations then you immediately see the result, but when deep within some service or application it's another matter entirely.
Trapping some classes of error is just a case of some transform logic, but how you get that up to the top (into the result) requires some additional thinking around what your various transformation modes will match against.
If an error is trapped low-down, then generate an error element with message and metadata and ensure the higher level templates can pass that error, maybe augmenting it too so that when it appears in the result, or as the result, you can see where it originated and how it got to the result.
Half-pipe's compiler now supports an
hp:error element that is used when it encounters an XProc step that it has not implemented. Templates are generated that will insert the error mark-up into the pipeline and any subsequent steps will allow the error message to pass through to the end of the pipeline.
This has most benefit for the
XProc Test Suite report, where the test suite driver transform matches against
hp:error elements and generates a fail result for that test, including the message from the error in the report with it.