You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Patrick Hunt (JIRA)" <ji...@apache.org> on 2009/08/19 23:15:14 UTC

[jira] Created: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
------------------------------------------------------------------------------------------------

                 Key: ZOOKEEPER-510
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
             Project: Zookeeper
          Issue Type: Bug
          Components: contrib-bindings
    Affects Versions: 3.2.0
            Reporter: Patrick Hunt
             Fix For: 3.3.0


The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.

We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Robinson updated ZOOKEEPER-510:
-------------------------------------

    Status: Patch Available  (was: Open)

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12762474#action_12762474 ] 

Henry Robinson commented on ZOOKEEPER-510:
------------------------------------------

I should mention that the segfault issue is already reported at ZOOKEEPER-540 - this patch should fix that issue and this one. 

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Robinson updated ZOOKEEPER-510:
-------------------------------------

    Attachment: ZOOKEEPER-510.patch

This patch adds exceptions, and expands the test suite to cover some commonly thrown exception cases. 

At the same time, it also includes a patch for the segfault issue when reusing a closed handle (since getting the exceptions right here requires fixing that issue, and fixing that issue requires proper exception testing). 

There were a couple of other bugs discovered during this process which this patch hopefully also squashes. 

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-510:
-----------------------------------

    Attachment: ZOOKEEPER-510.patch

this patch is the same as previous, except:

1) fixes log output of test to goto trunk/build/contrib heirarchy

2) adds a test for NodeExistsException

Unfortunately this test fails.

Henry, could you take a look? Am I doing something wrong here?

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761736#action_12761736 ] 

Patrick Hunt commented on ZOOKEEPER-510:
----------------------------------------

;-) well what I did works, but plz double check that it's right. thanks.

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763743#action_12763743 ] 

Mahadev konar commented on ZOOKEEPER-510:
-----------------------------------------

the patch looks good ...
henry, do we have a test case for ZOOKEEPER-540?



> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-510:
------------------------------------

      Resolution: Fixed
    Hadoop Flags: [Reviewed]
          Status: Resolved  (was: Patch Available)

I just committed this. thanks henry!

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-510:
-----------------------------------

    Fix Version/s: 3.2.2

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.2.2, 3.3.0
>
>         Attachments: ZOOKEEPER-510-incref.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12762804#action_12762804 ] 

Hadoop QA commented on ZOOKEEPER-510:
-------------------------------------

+1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12421360/ZOOKEEPER-510.patch
  against trunk revision 822065.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 25 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/19/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/19/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/19/console

This message is automatically generated.

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761730#action_12761730 ] 

Henry Robinson commented on ZOOKEEPER-510:
------------------------------------------

Hah, I'd just made the same patch. Good catch, thanks. Let me fix up some more tests and I'll upload patch for committing. 

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763901#action_12763901 ] 

Henry Robinson commented on ZOOKEEPER-510:
------------------------------------------

Hm, I had interpreted the Python documentation differently, by analogy with PyModule_AddIntConstant. I also tested but couldn't force a GC error. This is what I just tried:

>>> import zookeeper
>>> import gc
>>> gc.collect()
0
>>> zookeeper.set(0,"/","test")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
zookeeper.ZooKeeperException: zhandle out of range

I also tried removing the reference from the module before doing the gc, via del zookeeper.ZooKeeperException. 

However, I think you're right, by looking at other usage examples. I think it's acceptable to take the examples in the Python manual as canonical, so I support reinstating that line. 

The patch is simple, but I'm not sure how best to test it.  Perhaps forcing an exception pointer to NULL via a C module call, but then that would pollute the object's namespace. A test module that wasn't shipped, but built for testing? 

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-510:
-----------------------------------

    Attachment: ZOOKEEPER-510.patch

updated patch, same as before, except that you need to add the exception to the module (not just create it)

now passes the test I added


> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-510:
-----------------------------------

    Status: Patch Available  (was: Reopened)

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510-incref.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12758815#action_12758815 ] 

Patrick Hunt commented on ZOOKEEPER-510:
----------------------------------------

sounds good. I didn't mean/intend that python had to mirror java exactly, just that the closer it is the easier for ppl to transition. Obv we
should "pythonize" so that we fit std idioms, etc....

(glad to have you back! :-) )


> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-510:
-----------------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

+1 looks good. We are testing the usual cases and implemented per the python docs, afaict there's no way to verify this further (although we have tests that cover this in general)

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510-incref.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt reopened ZOOKEEPER-510:
------------------------------------


Unless I'm missing something there's a problem with this patch, the following is incorrect according to the python manual:

+#define ADD_EXCEPTION(x) x = PyErr_NewException("zookeeper."#x, ZooKeeperException, NULL); \
+  PyModule_AddObject(module, #x, x);

specifically the ref is not being incremented.

see this example in the following python man page:
http://docs.python.org/extending/extending.html#intermezzo-errors-and-exceptions

    SpamError = PyErr_NewException("spam.error", NULL, NULL);
    Py_INCREF(SpamError);
    PyModule_AddObject(m, "error", SpamError);



> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12758811#action_12758811 ] 

Henry Robinson commented on ZOOKEEPER-510:
------------------------------------------

(Just got back from a long vacation, hence apologies for being slow to pick this up!)

Yes, this is bad. zkpython needs to mirror the set of Java exceptions as closely as possible, and it shouldn't be hard to do. 

There are some special cases for when exceptions should be raised - checking for ret != ZOK doesn't always work. I'm thinking of exists, which (in ZooKeeper) special cases NONODE and returns null instead of a KeeperException. This seems sensible to me - just wanted to explicitly acknowledge that I'm using ZooKeeper.java as the reference for how a client API should behave since the API docs are vague on exactly when an exception is raised.



> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Robinson updated ZOOKEEPER-510:
-------------------------------------

    Attachment: ZOOKEEPER-510-incref.patch

Here's the patch for the incref issue. Try as I might, I haven't yet got a gc collection to dispose of the exception object and therefore trigger potential segfaults when the zookeeper module raises. So I haven't included any further tests. There are tests already that should exercise the paths prone to error if the behaviour of the gc does become more aggressive in future.

Like I said previously, the reference that Patrick provides appears to be authoritative and explicitly describes this situation, so I think it's clearly correct to INCREF the exception objects.



> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510-incref.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765321#action_12765321 ] 

Hadoop QA commented on ZOOKEEPER-510:
-------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12421957/ZOOKEEPER-510-incref.patch
  against trunk revision 824971.

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no tests are needed for this patch.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/23/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/23/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/23/console

This message is automatically generated.

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510-incref.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765509#action_12765509 ] 

Hudson commented on ZOOKEEPER-510:
----------------------------------

Integrated in ZooKeeper-trunk #497 (See [http://hudson.zones.apache.org/hudson/job/ZooKeeper-trunk/497/])
    . zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types (applying the incremental patch)


> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510-incref.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12764329#action_12764329 ] 

Hudson commented on ZOOKEEPER-510:
----------------------------------

Integrated in ZooKeeper-trunk #493 (See [http://hudson.zones.apache.org/hudson/job/ZooKeeper-trunk/493/])
    

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763754#action_12763754 ] 

Mahadev konar commented on ZOOKEEPER-510:
-----------------------------------------

great... missed it... my bad... 

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Robinson reassigned ZOOKEEPER-510:
----------------------------------------

    Assignee: Henry Robinson

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763749#action_12763749 ] 

Henry Robinson commented on ZOOKEEPER-510:
------------------------------------------

Yes - see testconnection in connection_test.py

Two cases: trying to close an already closed handle, and trying to issue commands on an already closed handle. Both should raise exceptions. 

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Henry Robinson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Robinson updated ZOOKEEPER-510:
-------------------------------------

    Attachment: ZOOKEEPER-510.patch

This patch adds all the exceptions that the Java client has, and replaces all the IOErrors with zookeeper.ZooKeeperException or direct descendants.

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-510) zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763835#action_12763835 ] 

Patrick Hunt commented on ZOOKEEPER-510:
----------------------------------------

I suggest creating an additional patch on this jira to address. Is this testable? the script could clear the exception from the module (it would be gc'd) then cause the code to raise the exception should cause seg fault?

> zkpython lumps all exceptions as IOError, needs specialized exceptions for KeeperException types
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-510
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-510
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-bindings
>    Affects Versions: 3.2.0
>            Reporter: Patrick Hunt
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>
>         Attachments: ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch, ZOOKEEPER-510.patch
>
>
> The current zkpython bindings always throw "IOError("text")" exceptions, even for ZK specific exceptions such as NODEEXISTS. This makes it difficult (error prone) to handle exceptions in python code. You can't easily pickup a connection loss vs a node exists for example. Of course you could match the error string, but this seems like a bad idea imo.
> We need to add specific exception types to the python binding that map directly to KeeperException/java types. It would also be useful to include the information provided by the KeeperException (like path in some cases), etc... as part of the error thrown to the python code. Would probably be a good idea to stay as close to java api as possible wrt mapping the errors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.