function createErrorWithCause(message, options) {
	// @ts-expect-error for tests
	const error = new Error(message, options);

	if (typeof (/** @type {ErrorWithCause} */ (error).cause) === "undefined") {
		/** @type {ErrorWithCause} */
		(error).cause = options.cause;
	}

	return error;
}
@param {string} message message
@param {{ cause: unknown }} options options
@returns {ErrorWithCause} error with cause