Handling Error Modeling and Transmission in TypeScript

How do you guys typically handle modelling errors when also sending those over the wire? Say I have packages server, frontend,
domain
. I create a Schema TaggedError which has a
message: string
and
cause: unknown
. This is defined in
domain
and added as a return type of an endpoint on my HttpApi. Within my server I want the cause to be there but when it's sent over the wire I don't want the cause to be there
Was this page helpful?