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

James E. King, III updated THRIFT-3363:
---------------------------------------
    Description: 
This may affect all languages, however it was initially reported against C++.

Every time a required field is not set, the exception that gets generated is a 
very generic:
    {{throw TProtocolException(TProtocolException::INVALID_DATA);}}

(see - 
https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=compiler/cpp/src/generate/t_cpp_generator.cc;h=298096d3265baa1f008501eb7c26bb4ae96ffa4b;hb=HEAD#l1372)

It would be useful to indicate the invalid data field in this exception case.

  was:
Thrift exceptions are somewhat difficult to trace from debug logs. I'd like to 
add __FILE__AND__LINE__ as a second parameter to some exceptions to make them 
easier to find.

For example:

Every time a required field is not set, the exception that gets generated is a 
very generic
throw TProtocolException(TProtocolException::INVALID_DATA)

see - 
https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=compiler/cpp/src/generate/t_cpp_generator.cc;h=298096d3265baa1f008501eb7c26bb4ae96ffa4b;hb=HEAD#l1372


I think I'll start with patching up TProtocolExcpetion in the compiler and if 
people like this I can make a separate issue and patch for other exceptions


> Reporting a missing required field to the client is not informative enough
> --------------------------------------------------------------------------
>
>                 Key: THRIFT-3363
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3363
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Compiler, C++ - Library
>            Reporter: James E. King, III
>            Assignee: James E. King, III
>            Priority: Minor
>              Labels: newbie
>
> This may affect all languages, however it was initially reported against C++.
> Every time a required field is not set, the exception that gets generated is 
> a very generic:
>     {{throw TProtocolException(TProtocolException::INVALID_DATA);}}
> (see - 
> https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=compiler/cpp/src/generate/t_cpp_generator.cc;h=298096d3265baa1f008501eb7c26bb4ae96ffa4b;hb=HEAD#l1372)
> It would be useful to indicate the invalid data field in this exception case.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to