You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Øyvind Smestad (JIRA)" <ji...@apache.org> on 2012/11/19 15:16:58 UTC

[jira] [Commented] (THRIFT-1706) jquery ajax code doesn't handle exceptions

    [ https://issues.apache.org/jira/browse/THRIFT-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13500251#comment-13500251 ] 

Øyvind Smestad commented on THRIFT-1706:
----------------------------------------

I also hit this issue, one possible solution to get this working with one callback is to modify thrift.js (version 0.9) from line 242:
{code:JavaScript}
success: jQuery.makeArray(args).pop(),
error: function (jqXHR, textStatus, errorThrown) {
  var callback = jQuery.makeArray(args).pop();
  callback.call(this, errorThrown);
}
{code}
This makes jQuery call the callback (with the error thrown by remote method) instead of dropping it on the floor and pretending nothing happend.
                
> jquery ajax code doesn't handle exceptions
> ------------------------------------------
>
>                 Key: THRIFT-1706
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1706
>             Project: Thrift
>          Issue Type: Bug
>          Components: JavaScript - Library
>    Affects Versions: 0.9
>            Reporter: Kevin Radloff
>
> The converter function inside of the jquery ajax handler makes no accommodations for exceptions that may be thrown during the normal course of running "recv_method.call()" for a remote method that raises an exception. If this happens, the result gets lost as the normal ajax response handling is aborted.
> It seems like the converter function should at the very least have a try/catch block that sets the exception as the ajax result in the place of a regular thrift type/object. It might be best to have some sort of interface that takes both a callback and errback, however, so as to not require introspection into the result.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira