an NTSTATUS exception type for python?

Jelmer Vernooij jelmer at samba.org
Fri Oct 5 03:21:05 MDT 2012


On Fri, 2012-10-05 at 11:20 +1000, Andrew Bartlett wrote:
> I wonder if you could give me a hand writing up a proper (not just
> RuntimeException) NTSTATUS exception class for python?
> 
> I would like to better handle errors in setting ACLs, and while I
> worked around the error I had by checking before the pysmbd call, it
> seems there should be a easy way to catch an ntstatus error.
> 
> We probably need to get the set of NT errors into IDL (and therefore
> python) and then create a new exception class.  
> 
> Do you have any specific pointers I should follow when doing this?
So, I've been holding off on this for a while for various reasons.

Having a common exception class means linking all Samba Python code to a
common Samba library thing which contains it or can handle it. This was
more of a deal before, but should be fine now.

We also should not simply raise a NTSTATUS exception for every ntstatus
error code (I think). E.g. NT_STATUS_NO_MEMORY should cause a
MemoryError to be raised.

Would you like to pair on this sometime?

Cheers,

Jelmer



More information about the samba-technical mailing list