[ 
https://issues.apache.org/jira/browse/THRIFT-471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Todd Lipcon updated THRIFT-471:
-------------------------------

    Patch Info: [Patch Available]

> Generated exceptions in Python should implement __str__
> -------------------------------------------------------
>
>                 Key: THRIFT-471
>                 URL: https://issues.apache.org/jira/browse/THRIFT-471
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Python)
>            Reporter: Todd Lipcon
>         Attachments: thrift-471.txt
>
>
> When the python generator makes an exception class since THRIFT-241, it does 
> not include a __str__ method. This is problematic since raised exceptions 
> don't include any useful information that might be part of the exception 
> struct.
> Without __str__:
> {code}
>   File 
> "/home/todd/hadoop/src/contrib/thriftfs/gen-py/hadoop/api/Namenode.py", line 
> 780, in recv_stat
>     raise result.err
> ttypes.IOException
> {code}
> With __str__:
> {code}
>   File 
> "/home/todd/hadoop/src/contrib/thriftfs/gen-py/hadoop/api/Namenode.py", line 
> 780, in recv_stat
>     raise result.err
> ttypes.IOException: IOException(msg=None, 
> stack='org.apache.hadoop.thriftfs.NamenodePlugin$ThriftHandler.fileStatusToStat(NamenodePlugin.java:373)\norg.apache.hadoop.thriftfs.NamenodePlugin$ThriftHandler.stat(NamenodePlugin.java:333)\norg.apache.hadoop.thriftfs.api.Namenode$Processor$stat.process(Namenode.java:1350)\norg.apache.hadoop.thriftfs.api.Namenode$Processor.process(Namenode.java:1054)\norg.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:240)\njava.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)\njava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)\njava.lang.Thread.run(Thread.java:619)\n')
> {code}
> Clearly the latter is way more useful.
> Patch to follow if no one objects.

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

Reply via email to