Currently when a query fails we return a "server misbehaving" error. RFC 8914 allows the resolver to include detailed errors about the failure of a DNS query. It would be nice to support it in the pure go resolver. We already support EDNS(0), so it should be fairly easy to add.
The only thing that I am not sure about is the optional EXTRA-TEXT field of the EDE Option, it would be nice to include it in the error, but it can be an arbitrary UTF-8 string. We should probably not include arbitrary characters in the error string. Not sure about that.
CC @mjl- (#63116 (comment))