MCPcopy
hub / github.com/pyodide/pyodide / generateDestroyedMessage

Function generateDestroyedMessage

src/core/pyproxy.ts:459–486  ·  view source on GitHub ↗
(
  proxy: PyProxy,
  destroyed_msg: string,
)

Source from the content-addressed store, hash-verified

457}
458
459function generateDestroyedMessage(
460 proxy: PyProxy,
461 destroyed_msg: string,
462): string {
463 destroyed_msg = destroyed_msg || "Object has already been destroyed";
464 if (API.debug_ffi) {
465 let proxy_type = proxy.type;
466 let proxy_repr;
467 try {
468 proxy_repr = proxy.toString();
469 } catch (e) {
470 if ((e as any).pyodide_fatal_error) {
471 throw e;
472 }
473 }
474 destroyed_msg += "\n" + `The object was of type "${proxy_type}" and `;
475 if (proxy_repr) {
476 destroyed_msg += `had repr "${proxy_repr}"`;
477 } else {
478 destroyed_msg += "an error was raised when trying to generate its repr";
479 }
480 } else {
481 destroyed_msg +=
482 "\n" +
483 "For more information about the cause of this error, use `pyodide.setDebug(true)`";
484 }
485 return destroyed_msg;
486}
487
488Module.pyproxy_destroy = function (
489 proxy: PyProxy,

Callers 1

pyproxy.tsFile · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…