function error_to_pojo(error) {
	if (isHttpError(error)) {
		return {
			status: error.status,
			...error.body
		};
	}

	const { name, message, stack, ...custom } = error;
	return { name, message, stack, ...custom };
}
Transform an error into a POJO, by copying its `name`, `message`
and (in dev) `stack`, plus any custom properties, plus recursively
serialized `cause` properties.

@param {Error} error