(where, e)
| 15 | let errorMsg = null; |
| 16 | // Surfaces async errors (listener throws, observer callbacks, swallowed promise rejections) to Python. Falls back to console.error if no consumer bound via bind_global_error. |
| 17 | const emitError = (where, e) => { |
| 18 | if (errorMsg) ctx.pushEvent(JSON.stringify({ |
| 19 | msg: errorMsg, |
| 20 | where, |
| 21 | error: (e && e.message) ? e.message : String(e), |
| 22 | stack: (e && e.stack) ? e.stack : undefined, |
| 23 | })); |
| 24 | else console.error(`[dom:${where}]`, e); |
| 25 | }; |
| 26 | const ctxPlus = { ...ctx, emitError }; |
| 27 | return Object.assign( |
| 28 | {}, |
no test coverage detected