[
https://issues.apache.org/jira/browse/THRIFT-517?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901408#action_12901408
]
Adrian Woodhead commented on THRIFT-517:
----------------------------------------
I personally would like to get more detailed error messages on the client - in
setups where thrift clients and servers are written by different teams of
developers it helps each team know where the root cause of an exception is.
When the server devs get bug reports it would also help a lot if there was more
information than just "tried to read 4 bytes" as this is useless for figuring
out what actually went wrong. We now end up writing try/catch throwable blocks
in each and every thrift method so we can log the server exception and rethrow
it as a checked exception which isn't exactly elegant but has to be done
otherwise we have no idea where errors are occurring.
If you are against it I would be happy to settle for at least receiving a less
cryptic message - the equivalent of an HTTP 500 "something went wrong on the
server".
> TExceptions thrown by server result in cryptic error message on client -
> Tried to read 4 bytes, but only got 0 bytes
> --------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-517
> URL: https://issues.apache.org/jira/browse/THRIFT-517
> Project: Thrift
> Issue Type: Bug
> Components: Java - Compiler, Java - Library
> Reporter: Adrian Woodhead
>
> To reproduce:
> 1. Define a simple Thrift service method with no custom exceptions.
> 2. In server implementation of service method, throw a TException.
> 3. Generated code in client forces you to do try/catch TException around
> service call, do this, and output stack trace,
> The exception thrown by the server then results in this rather cryptic error
> message in the client:
> 26 22:32:44,931 INFO Caused by:
> org.apache.thrift.transport.TTransportException: Cannot read. Remote side has
> closed. Tried to read 4 bytes, but only got 0 bytes.
> 26 22:32:44,931 INFO at
> org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
> 26 22:32:44,931 INFO at
> org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:314)
> 26 22:32:44,931 INFO at
> org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:262)
> 26 22:32:44,931 INFO at
> org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:192)
> 26 22:32:44,931 INFO at
> fm.last.catalogue.api.TCatalogueAPI$Client.recv_getTrackById(TCatalogueAPI.java:249)
> It would be better if the client got the actual TException sent by the
> server, or at the very least a better error message indicating that an
> unexpected error occurred on the server (akin to an HTTP 500 message that
> most web servers use).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.