Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

442 B
Raw Blame
import { DATA_APP_ERROR_MESSAGE_TYPE } from "../../constants";

import type { ErrorDetail } from "./describe-error";

export function reportErrorToParent(notReady: boolean, detail?: ErrorDetail) {
  if (window.parent === window) {
    return;
  }

  window.parent.postMessage(
    {
      type: DATA_APP_ERROR_MESSAGE_TYPE,
      notReady,
      message: detail?.message,
      stack: detail?.stack,
    },
    window.location.origin,
  );
}