File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
utils/editors/js-console/html/output-console/v2.0 Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 342342
343343 <script type=module>
344344
345+ // Catch *everything* the iframe might throw
346+ window.addEventListener("error", (e) => {
347+ console.log("iframe error:", e.message);
348+ });
349+
350+ window.addEventListener("unhandledrejection", (e) => {
351+ console.log("iframe unhandledrejection:", e.reason);
352+ });
353+
345354 window.addEventListener('message',async({data})=>{
346355
347356 var {js} = data;
348- var blob = new Blob([js],{type:'text/javascript'});
349- var url = window.URL.createObjectURL(blob);
350- await import(url);
357+ try{
358+ var blob = new Blob([js],{type:'text/javascript'});
359+ var url = window.URL.createObjectURL(blob);
360+ await import(url);
361+ }
362+ catch(err){
363+ console.error('iport failed',err);
364+ }
351365
352366 });
353367
You can’t perform that action at this time.
0 commit comments