In my program I have a long code that reads through a text input, finding separators, letters, and numbers,to decode into a bunch of nodes.
This will cause exceptions if the user isn’t too bright or a jerk, soooo… how do I stupid proof that script?
Like, if there’s an exception while parsing “banana” into an int, it just stops, and runs some code that resets and clears any damage…
I read something about “try{ }”, but it’s not clear as to what happens when there actually is an exception, and what happens/is returned (and where??) when there isn’t an exception.
Anything inside the try-block is executed until the exception happens (lines inside the try-block after the exception line are skipped). If there’s no exception the catch-blocks are ignored and execution continues. If there is an exception, a catch block with parameter of the same type as the exception is searched for. If found, that catch-block is executed. If not the program crashes. Parameterless catch catches all exceptions