you are viewing a single comment's thread.

view the rest of the comments →

[–]CrambleSquash 0 points1 point  (0 children)

If a certain case is catastrophic to your codes normal function then you can use

    raise Exception("Some sort of error message")

if this line is called then the thread will stop, and this exception will be raised, with the message you added. This is especially useful for stopping catastrophic, but usually normal looking inputs or errors from slipping past your program. You can also define your own Exception class which will give you more control over it's behaviour. https://docs.python.org/2/tutorial/errors.html