One problem with ActivityPub is that there is not a standard format for errors returned from the API or federation protocol.
I wrote a Fediverse Enhancement Proposal (FEP) to establish a standard set of error messages using RFC 9457, Problem Details for HTTP APIs.
It'd be great to get some review here:
https://codeberg.org/fediverse/fep/src/branch/main/fep/c180/fep-c180.md
Comments and suggestions here (or just reply):
https://codeberg.org/evanp/fep/issues
..