diff --git a/src/lib/sandbox/main-serialization.ts b/src/lib/sandbox/main-serialization.ts index 6e6c9e81..780d4631 100644 --- a/src/lib/sandbox/main-serialization.ts +++ b/src/lib/sandbox/main-serialization.ts @@ -127,9 +127,10 @@ const serializeCssRuleForWorker = (cssRule: any) => { } return obj; }; - +let ErrorObject: any = null; const serializedValueIsError = (value: any) => { - return value instanceof (window.top as any).Error; + ErrorObject = (window.top as any)?.Error || ErrorObject; + return value instanceof ErrorObject; }; export const deserializeFromWorker = (