The use case is as follows:
If an item is published, but some of the component presentations were not rendered, we want to set the status to Warning (but still publish the page(s) as normal). The aim of this is to alert Editors to the fact that they have added content to a page that has not been rendered (ie an invalid content type on the page).
It is easy enough to detect whether some CPs are not rendered by checking the RenderedItem.ChildRenderedItems against the Page component presentations using a TBB in the Page Template, and I have managed to simulate the Warning state and useful error messages on a component by component basis by rendering the missing components against a dummy Component Template which always throws an error.
However, this only works if the number of Render Failures allowed in the Publish Instruction is greater than zero. If it is zero (the default) then the publish transaction fails at the Rendering stage and no content is published (and you get an Error state in the publishing queue).
I tried updating the publish transaction status to Warning in my TBB, and not rendering the error template, however this only works temporarily - on deployment you see that the status goes through the deployment statuses and ends up with Success.
Finally I tried updating the Publish Instruction to set the number of render failures to be 100, however this doesn't work either (I guess this object is not update-able from template code as there is no .Save()
method).
Does anyone have any bright ideas how else I can solve this in Template code - I guess there is something I can do in the event system, but I want to avoid this if possible.