( proxy: PyProxy, destroyed_msg: string, )
| 457 | } |
| 458 | |
| 459 | function 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 | |
| 488 | Module.pyproxy_destroy = function ( |
| 489 | proxy: PyProxy, |
no test coverage detected
searching dependent graphs…