11 Apr
2003
11 Apr
'03
2:04 p.m.
You can catch most string exceptions. "Bad Request" cannot be caught because (afaik) the string isn't interned because it has a space in it.
You're skating on thin ice there, mate! This is an accident of the implementation.
As a workaround, I'd use except: then do
try: something except: e = sys.exc_info() if e[0] == 'Bad Request': do something raise
Why is there code writing raise 'Bad Request' That code should be fixed! It ought to use a class exception; if that's not possible, it ought to at least give the string a global name, like so: BadRequest = 'Bad Request' . . . raise BadRequest --Guido van Rossum (home page: http://www.python.org/~guido/)