How to catch runtime error gracefully

12 views
Skip to first unread message

Eilon

unread,
May 7, 2025, 3:50:20 AMMay 7
to brython
Please check the JSFiddle (link below):
on line 30 - I'm trying to print no defined variable (on purpose)
I want to catch the error and print a nice message, with alert, including the error line number

Thank you

https://jsfiddle.net/yalondpsi/csx8ej07/123/

Denis Migdal

unread,
May 7, 2025, 6:51:52 AMMay 7
to bry...@googlegroups.com

try:
print(name)
except Exception as e:
      print("c")

--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/brython/2ed4956a-a773-4315-9911-22454e36fc0bn%40googlegroups.com.

Eilon

unread,
May 7, 2025, 7:28:57 AMMay 7
to brython
of course.. :)
Reply all
Reply to author
Forward
0 new messages