How do I get the TerminatedFailure's reason of a ChildWorkflow?

I’m using Workflow and ChildWorkflow like this:

I want to get the Terminate Reason when I catch the Exception.

Thanks for your response!

Terminate is like a “kill -9” and you will not be able to catch it inside your child workflow that you are terminating.

You can catch child termination inside your workflow code. Child invocations always throw ChildWorkflowFailure, so in your workflow code you could do for example:

try {
   promise.get(); // wait for child workflow to complete
} catch (ChildWorkflowFailure e) {
        // ChildWorkflowFailure would contain TerminateFailure as its cause
        TerminatedFailure t = (TerminatedFailure) e.getCause();
        // ...
}

Thanks for your repay!

But when terminating a workflowStub, need a reason here:

How can I get this reason when caught the TerminatedFailure?

Waiting for your repaly, thanks.