Raise BPMN error from a user task as a boundary event

Can we invoke a boundary error event from a user task form. The requirement is as soon as the user clicks a button in a user form – a BPMN error should be raised and it should invoke a subprocess flow. Please help. I am unable create a executable bpmn and also would need the piece of Java code which is required to be written while raising the error

Thanks
Gaga

You can’t raise an error from a user task - but you can send a message event which then triggers an error.