Transcrypt icon indicating copy to clipboard operation
Transcrypt copied to clipboard

Accessing a non-existing key in a dict results in an uncatchable JS error "Uncaught TypeError" instead of a pythonic "KeyError" exception

Open halloleo opened this issue 4 years ago • 0 comments

When I access a non-existing key in a dictionary, I get

Uncaught TypeError: rangePerColor[i] is undefined

I would have expected a Python exception like

KeyError: 7

Furthermore, this error cannot be caught with a try ... except block.

What can I do to catch this problem?

halloleo avatar Jan 13 '22 08:01 halloleo