Closed den-run-ai closed 5 months ago
Hi, if you run the following minimal example it will print the assertion failure to the console:
import pythonmonkey as pm pm.eval('console.assert(false)') Assertion failed
This makes it difficult to catch/handle on Python side, when only printed to the console.
On Wed, Jun 5, 2024 at 8:12 AM philippedistributive < @.***> wrote:
Hi, if you run the following minimal example it will print the assertion failure to the console:
import pythonmonkey as pm pm.eval('console.assert(false)') Assertion failed
— Reply to this email directly, view it on GitHub https://github.com/Distributive-Network/PythonMonkey/issues/358#issuecomment-2150322231, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4BTZODBP3WSOTIAH4B5JTZF4TGJAVCNFSM6AAAAABIZP4AXKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJQGMZDEMRTGE . You are receiving this because you authored the thread.Message ID: @.***>
If you look at the specs for assert: https://developer.mozilla.org/en-US/docs/Web/API/console/assert_static printing to the console is all the assert method does
Perhaps you mean to use console.trace? https://developer.mozilla.org/en-US/docs/Web/API/console/trace_static That should print according to specs as well...
Please see https://github.com/Distributive-Network/PythonMonkey/pull/360 for a yet-unreleased fix to console.trace
Describe your feature request here.
How can I catch console.assert condition failure in Python?
Code example
No response