Transcrypt
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
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?