Can I use a struct containing error as application error details field?

You cannot pass application specific failures across process boundaries. Any non temporal error is converted to an ApplicationError. You can attach any application specific information to that error as details.

See Returning partial results from activity on error and Temporal Failures | Temporal Documentation