https://bugzilla.novell.com/show_bug.cgi?id=280034#c4 --- Comment #4 from Marcus Hüwe <suse-tux@gmx.de> 2007-07-25 05:08:31 MST --- I thought about it a bit.. what about something like this: def http_safe_request(func, *args): try: return func(*args) except urllib2.HTTPError, e: if e.code == 404: print >>sys.stderr, 'error 404 - does not exist' sys.exit(1) elif e.code == 403: print >>sys.stderr, 'error 403 - access denied' sys.exit(1) elif e.code == 401: print >>sys.stderr, 'error 401 - authentication required' sys.exit(1) else: print >>sys.stderr, 'unexpected error: \'%s\'' % e.code sys.exit(1) And everytime we need exception handling (like osc buildinfo) we could call http_safe_request(http_POST, url, otherdata) (in the case of osc buildinfo) and if urllib2 throws and exception it'll be handled immediately. The advantage of such a function is that we don't have to do exception handling in every method which uses a http_* call (this would blow up the code IMHO). -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.