How can I know the activity was canceled or executed with no err in workflow code?

I need to mark some info if an activity is canceled

err := workflow.ExecuteActivity(ctx, activity, args...).Get(ctx, nil)
// do sth if the activity is cancel

when cancel a workflow, activities that have not been executed will be cancel and these activity will return no err. how can I know the activity was canceled or executed with no err in workflow code?

I find it

if errors.Is(ctx.Err(), workflow.ErrCanceled) {
	// do activity cancel hook 
}