Skip to content

Commit 9a2569f

Browse files
save file
1 parent b1e890a commit 9a2569f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

utils/editors/js-console/html/output-console/v2.0/output-console-v2.0.html

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,26 @@
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

0 commit comments

Comments
 (0)