Sanitise an error into a small structured object without stack traces.
error to sanitise
Optional
registry used to scrub messages
{ name, code, message }
Sanitise an error into a small structured object without stack traces.