@Override public Next receive(Object o) { if (!isLaunched()) { // failed before we even started. fake the start node that start() would have created. FlowHead h = CpsThread.current().head; StepStartNode ssn = addBodyStartFlowNode(h); h.setNewHead(ssn); } StepEndNode en = addBodyEndFlowNode(); Throwable t = (Throwable)o; en.addAction(new ErrorAction(t)); CpsFlowExecution.maybeAutoPersistNode(en); setOutcome(new Outcome(null,t)); StepContext sc = new CpsBodySubContext(context, en); for (BodyExecutionCallback c : callbacks) { c.onFailure(sc, t); } synchronized (CpsBodyExecution.this) { thread.popContextVariables(); } return Next.terminate(null); }