Fetching Details from temporal NonRetryableApplicationError

In one of my temporal activities, I am returning a

return temporal.NewNonRetryableApplicationError("message", "Failed", errFoo,"HelloDetails"))

In my workflow which calls the activity, I query the application Error returned as below,

var appErr *temporal.ApplicationError
if errors.As(err, &appErr) {
	fmt.Println("Has data", appErr.HasDetails()) -> returns false
	if err = appErr.Details(&Details); err != nil {
		fmt.Println("Error in setting details", err) -> returns Error in setting details "no data available"
		return err
	}
}

There is an error in appErr.Details with error being returned as “no data available”.
Is there anything that I am missing?

Even though details is set in the NewNonRetryableApplicationError object, I am not able to fetch the details and put it in

I would like some help in how to fetch the details field that has been set in the NewNonRetryableApplicationError.

Are you trying to get the “HelloDetails” details message (string type) from NewNonRetryableApplicationError?
If so you could do:

    var applicationErr *temporal.ApplicationError
	if errors.As(err, &applicationErr) {
		var detailMsg string
		applicationErr.Details(&detailMsg)
		logger.Error(detailMsg)
	}

The same set of changes I have used, but still the data which returned from activity to workflow and i am getting as (empty). Could you please help in resolving this.

Do you see this data in the ActivityTaskFailed event in the workflow history?

When I print logger.err(logging.Error(err)) → prints as " time is old (type: ApplicationError, retryable: true): "

But I print after the below change,

logger.err(logging.Error(err))
if errors.As(err, &appErr) {
			var temp wfstatus
			fmt.Println(appErr.HasDetails())  ---> false
			preCheckErr := appErr.Details(&temp)
         		fmt.Println(temp)------------------------------>{         0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC    0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC map[] {{ { [] []} { [] []} { [] []}} { { [] []} { [] []} { [] []} { [] []} { [] []}} { { [] []} { [] []} { [] []} { [] []}} { { [] []}}} }
[]

Does the ActivityTaskFailed event when you look at it in the UI or through tctl contain any data?