Bug 34490 - Proper exception hierarchy for UMCConnection
Proper exception hierarchy for UMCConnection
Status: RESOLVED DUPLICATE of bug 34498
Product: UCS
Classification: Unclassified
Component: univention-lib
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.x
Assigned To: UCS maintainers
:
Depends on:
Blocks: 38720
  Show dependency treegraph
 
Reported: 2014-04-07 13:50 CEST by Philipp Hahn
Modified: 2017-01-20 16:52 CET (History)
2 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
Exception hierarchy for UMCConnection lib + cleanup. (3.99 KB, patch)
2014-04-07 13:50 CEST, Philipp Hahn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2014-04-07 13:50:19 CEST
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.
Comment 1 Florian Best univentionstaff 2014-04-07 15:16:35 CEST
vote++
Comment 2 Florian Best univentionstaff 2017-01-20 16:52:48 CET

*** This bug has been marked as a duplicate of bug 34498 ***