import React from "react"; import { HttpError } from "@calcom/lib/http-error"; type Props = { statusCode?: number | null; error?: Error | HttpError | null; message?: string; /** Display debugging information */ displayDebug?: boolean; children?: never; }; const defaultProps = { displayDebug: false, }; const ErrorDebugPanel: React.FC<{ error: Props["error"]; children?: never }> = (props) => { const { error: e } = props; const debugMap = [ ["error.message", e?.message], ["error.name", e?.name], ["error.class", e instanceof Error ? e.constructor.name : undefined], ["http.url", e instanceof HttpError ? e.url : undefined], ["http.status", e instanceof HttpError ? e.statusCode : undefined], ["http.cause", e instanceof HttpError ? e.cause?.message : undefined], ["error.stack", e instanceof Error ? e.stack : undefined], ]; return (
{debugMap.map(([key, value]) => { if (value !== undefined) { return (
{key}
{value}
); } })}
); }; export const ErrorPage: React.FC = (props) => { const { message, statusCode, error, displayDebug } = { ...defaultProps, ...props }; return ( <>

{statusCode}

{message}

{displayDebug && (
)}
); };