It's using xmpppy. Since xmpppy does not throw any exceptions if it could not connect or authenticate, I need to throw them myself. The question is, how do I catch those exceptions I throw to output only the error message, but not the full traceback, and keep the code running despite them?

This is true, I was simply emulating the question for this answer.
–
LattySep 24 '11 at 10:42

@Lattyware Please look at the EDIT of the question. Is this what you mean?
–
Andriy YurchukSep 24 '11 at 10:59

@AndriyYurchuk No, My example was just that, an example. You should simply do 'raise WhateverError('Message')' whenever you want to raise an error. Then when you write the code that uses that function (say the function that connects in your example), then you wrap that code in a try/except block as I showed.
–
LattySep 30 '11 at 22:44