On Thu, Aug 16, 2012 at 01:08:38AM +1100, Rafael H. Schloming (JIRA) wrote:
> Ok, going over this one with a less congested head, I've noticed an issue. 
> The %contract stuff is great for making exceptions occur, but at least for 
> things like checking return error codes it seems to swallow the actual reason 
> for the exception, e.g.:
>     File "/home/rhs/bin/proton-test", line 331, in run
>       phase()
>     File "/home/rhs/proton/tests/proton_tests/messenger.py", line 93, in 
> testSendBogus
>       pn_messenger_put(self.client, msg)
>   RuntimeError: Contract violation: ensure: (result==0)
> I think this is a problem given that things like, pn_messenger_send returns 
> an error code which indicates what has actually gone wrong, and there is a 
> big difference between say a PN_TIMEOUT (indicates that send has blocked for 
> longer than the timeout set for the messenger, not necessarily an error 
> per/se), and PN_STATE_ERR, (indicates the messenger is in some kind of 
> illegal state).

Talking this over in IRC, Rafe and I agree that the contracts are likely
a little over-zealous in handling error conditions. So I'm going to
rework the patch to not raise exceptions on error response codes.

Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.

Attachment: pgpqnqkiB0Hq5.pgp
Description: PGP signature

Reply via email to