import { reportApiError } from '@/utils/apiError';

/** Homepage blocks are optional; a failed load must not hide their siblings. */
export async function loadHomepageBlock<T>(
  name: string,
  load: () => Promise<T>
): Promise<T | null> {
  try {
    return await load();
  } catch (error) {
    reportApiError(error, `Homepage block unavailable (${name}):`);
    return null;
  }
}
