/** * SafeErrorMessage - Redacts filesystem paths and internal details from error * messages before they are returned to remote clients. * @class SafeErrorMessage * @example * SafeErrorMessage.sanitize(new Error("open '/home/user/db'")); * // 'open ' */ export default class SafeErrorMessage { static readonly MAX_MESSAGE_LENGTH = 300; static readonly FALLBACK_MESSAGE = "An internal error occurred. Please try again later."; /** * Sanitizes an error for transmission to a remote client. * @param error - The caught error (may be any unknown). * @returns A single-line, path-redacted message with a bounded length. */ static sanitize(error: unknown): string; }