Modified by www.SourceFiles.app
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
type LovableErrorOptions = {
|
||||||
|
mechanism?: "manual" | "onerror" | "unhandledrejection" | "react_error_boundary";
|
||||||
|
handled?: boolean;
|
||||||
|
severity?: "error" | "warning" | "info";
|
||||||
|
};
|
||||||
|
|
||||||
|
type LovableEvents = {
|
||||||
|
captureException?: (
|
||||||
|
error: unknown,
|
||||||
|
context?: Record<string, unknown>,
|
||||||
|
options?: LovableErrorOptions,
|
||||||
|
) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
__lovableEvents?: LovableEvents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function reportLovableError(error: unknown, context: Record<string, unknown> = {}) {
|
||||||
|
if (typeof window === "undefined") return;
|
||||||
|
window.__lovableEvents?.captureException?.(
|
||||||
|
error,
|
||||||
|
{
|
||||||
|
source: "react_error_boundary",
|
||||||
|
route: window.location.pathname,
|
||||||
|
...context,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
mechanism: "react_error_boundary",
|
||||||
|
handled: false,
|
||||||
|
severity: "error",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user