You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jonathan Ellis (JIRA)" <ji...@apache.org> on 2009/04/21 18:40:47 UTC

[jira] Updated: (THRIFT-378) Java servers do not turn internal errors into thrift exceptions

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

Jonathan Ellis updated THRIFT-378:
----------------------------------

    Attachment: thrift-378.patch

add TApplicationException.INTERNAL_ERROR.  return that when a service method throws an unexpected exception.

IMO this is the right way to go because it is backwards compatible with old thrift clients as well as non-Java clients that do not know about INTERNAL_ERROR (because the client doesn't actually care about the enum value).  Tested with a Python client; worked fine.

This is orthogonal to the issue of what the proper exception hierarchy should be (no new exception types are introduced).

> Java servers do not turn internal errors into thrift exceptions
> ---------------------------------------------------------------
>
>                 Key: THRIFT-378
>                 URL: https://issues.apache.org/jira/browse/THRIFT-378
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Jonathan Ellis
>            Priority: Minor
>             Fix For: 0.2
>
>         Attachments: thrift-378.patch
>
>
> Occasionally a service will produce a runtime exception because of a problem in the environment or simply a bug.
> By default this means clients will error out trying to read a response.  This is confusing because it is not obvious that the problem was with the server, let alone what the problem actually was.
> One workaround might be to add an InternalError exception and declare every method to throw that, but this would require wrapping each method implementation on the server with a try/catch/throw block, which is ugly and repetitive (especially if there are other try/catch blocks nested) -- exactly the sort of code that Thrift is good at automating away.
> I think the right fix would be for the server to catch runtime exceptions in the generated process methods and send back a TApplicationException.  This is what some other servers (e.g., Erlang) already do.

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