I did not know that onError you mentioned was associated with xhrpost/xhrget,
was thinking that validation+error management should be handled together at either server side or client side. to perform validation and error management at different sides is new stuff for me as well........always believe that code at client side runs at render response phase, and facesmessage is requestScope, will vanish after invoke application phrase,
just to put some final effort here eventhough I am aware that I am not at that level to answer this question
How to trigger an onError handler on the client side in response to a condition on the server-side
instead of triggering an onError........
to synchronize client/server side script as in http://nodejs.org/, use Remote Services from extension library...then client side script will catch real object from server side, call back function not exists only in onError but also in that editor that we normally use....