Closed jugmac00 closed 2 years ago
Raising zope.publisher.NotFound in Zope 4 context leads to a zExceptions.NotFound
exception which is known by Zope 4. Any other custom exception with the name of an Exception known by Zope is upgraded the same way.
It should be even possible to create a custom Exception in a PythonScript an get it converted to the proper exception here.
This whole behavior might be a feature. At least is the list of possible names definitely too long.
The next step right after accessing the exception name from the module is to check if it is an exception class:
So I tend to close this issue as invalid
.
I agree
When trying to upgrade an exception, in following code... https://github.com/zopefoundation/zExceptions/blob/b0c3422abde21849d38c6cc3a64e0c3d34ea701e/src/zExceptions/__init__.py#L505 there is a lookup of the incoming exception in the zException name space.
There are a lot of exceptions listed, but also e.g. dunder methods and other, see pdp snippet.
There should be only a match with real exceptions.
P.S.: Anybody knows a use case for this upgrading once string exceptions are no longer allowed?