/**
 * Extracts a human-readable error message from an unknown error value.
 * Handles Error instances, string errors, and other types safely.
 */
export function getErrorMessage(error) {
    if (error instanceof Error) {
        return error.message;
    }
    if (typeof error === "string") {
        return error;
    }
    return String(error);
}
/**
 * Extracts an error message from an unknown error value, with a fallback
 * for when no message can be extracted.
 */
export function getErrorMessageOr(error, fallback) {
    if (error instanceof Error) {
        return error.message;
    }
    if (typeof error === "string" && error.length > 0) {
        return error;
    }
    return fallback;
}
//# sourceMappingURL=error-utils.js.map