Extract a safe, human-readable error message from an unknown caught value.
Returns error.message for Error instances; 'Unknown error' otherwise.
Avoids String(error) which can produce "[object Object]" for non-Error
throws and may expose custom toString() output unexpectedly.
Parameters
error: unknown
Caught error value (unknown type from catch clause)
Returns string
Human-readable error message safe for audit logging
Extract a safe, human-readable error message from an unknown caught value. Returns
error.messagefor Error instances;'Unknown error'otherwise. AvoidsString(error)which can produce"[object Object]"for non-Error throws and may expose customtoString()output unexpectedly.