Univention Bugzilla – Bug 34490
Proper exception hierarchy for UMCConnection
Last modified: 2017-01-20 16:52:48 CET
Created attachment 5856 [details] Exception hierarchy for UMCConnection lib + cleanup. base/univention-lib/python/umc_connection.py#UMCConnection() raises and passes through several different exception classes, which are not below some common base exception. This complicates error handling, as "Exception" must be caught which catches too much: raise ValueError('No cookie') raise NotImplementedError('command forbidden: %s' % url) raise HTTPException(error_message) It would be better to introduce a new base error class like class UMCConnectionError(HTTPException): pass class UMCConnectionUnknownCommand(UMCConnectionError): pass class UMCConnectionRequestError(UMCConnectionError): pass and to not raise an NotImplementedError(), as that error is reserved for a completely different set of errors in Python.
vote++
*** This bug has been marked as a duplicate of bug 34498 ***