[openstack-dev] [all] Deprecating exceptions

Ihar Hrachyshka ihrachys at redhat.com
Mon Sep 22 15:24:33 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 22/09/14 17:07, Radomir Dopieralski wrote:
> Horizon's tests were recently broken by a change in the Ceilometer 
> client that removed a deprecated exception. The exception was
> deprecated for a while already, but as it often is, nobody did the 
> work of removing all references to it from Horizon before it was
> too late. Sure, in theory we should all be reading the release
> notes of all versions of all dependencies and acting upon things
> like this. In practice, if there is no warning generated in the
> unit tests, nobody is going to do anything about it.
> 
> So I sat down and started thinking about how to best generate a
> warning when someone is trying to catch a deprecated exception. I
> came up with this code:
> 
> http://paste.openstack.org/show/114170/
> 
> It's not pretty -- it is based on the fact that the `except`
> statement has to do a subclass check on the exceptions it is
> catching. It requires a metaclass and a class decorator to work,
> and it uses a global variable. I'm sure it would be possible to do
> it in a little bit cleaner way. But at least it gives us the
> warning (sure, only if an exception is actually being thrown, but
> that's test coverage problem).
> 
> I propose to do exception deprecating in this way in the future.
> 

Aren't clients supposed to be backwards compatible? Isn't it the exact
reason why we don't maintain stable branches for client modules?

So, another reason to actually start maintaining those stable branches
for clients. We already do it in RDO (Red Hat backed Openstack
distribution) anyway.

/Ihar
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)

iQEcBAEBCgAGBQJUID8xAAoJEC5aWaUY1u57A4IH/RiRtEfFOQjqb2Dr86HTPHGW
XQuUGlB2E3t/VnhDNv0xwlAJg+rnsRv9j/Vlpkyx2LNwOp3SHlmOrA4upB6dW1xc
v7BL02vaKTW2LUwBvVyEOwL0xSywh12260kpl2UBlLFt7xytWQLFaDkGUSAE504Q
EPQg9CSpfqiPz88PTQ0SeFbE2FOtslwTXMb0/tyef34vhfyH7o1rYJNZ7ajAY+iI
S4dkKoVrnjhOpg8RqjYHcj+USy49ECRpz87mB7BwhF2Av4d0BeWhmVvanN8vqDsf
qG785w41Cry+/lLia4Ay0BQnFf1wRVMFdPzHZrhcAJgdOq88KhrW3E879itt464=
=qD0z
-----END PGP SIGNATURE-----



More information about the OpenStack-dev mailing list