[
https://issues.apache.org/jira/browse/THRIFT-2584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14041938#comment-14041938
]
Henrique Mendonça commented on THRIFT-2584:
-------------------------------------------
Hi David,
I don't think this is a problem here. When the callback is set, the Thrift
services return a Deferred object from JQuery like in
http://api.jquery.com/jquery.ajax/ so you only need to run:
{code}
client.service(param, function(){}).fail(function() {
alert( "error" );
});
{code}
It's really unfortunately that we still don't have this documented, I'll try to
have a look on this today or tomorrow. An alternative would be to also remove
the callback from the parameters list and always run asynchronously like JQuery
also currently does.
Please let us know if you have any other problem.
Cheers,
Henrique
> Error handler not listened on javascript client
> -----------------------------------------------
>
> Key: THRIFT-2584
> URL: https://issues.apache.org/jira/browse/THRIFT-2584
> Project: Thrift
> Issue Type: Bug
> Components: JavaScript - Library
> Affects Versions: 0.9.1, 0.9.2
> Reporter: David Poulailleau
> Assignee: Randy Abernethy
>
> jQuery's error are not handled in the ajax call. This causes the callback not
> to be called when an error happened during a server call.
> In library, the ajax call looks like this :
> var jqXHR = jQuery.ajax({
> url: this.url,
> data: postData,
> type: 'POST',
> cache: false,
> contentType: 'application/json',
> dataType: 'text thrift',
> converters: {
> 'text thrift' : function(responseData) {
> thriftTransport.setRecvBuffer(responseData);
> var value = recv_method.call(client);
> return value;
> }
> },
> context: client,
> success: jQuery.makeArray(args).pop()
> });
> Setting object should have an error key, something like this :
> var jqXHR = jQuery.ajax({
> url: this.url,
> data: postData,
> type: 'POST',
> cache: false,
> contentType: 'application/json',
> dataType: 'text thrift',
> converters: {
> 'text thrift' : function(responseData) {
> thriftTransport.setRecvBuffer(responseData);
> var value = recv_method.call(client);
> return value;
> }
> },
> context: client,
> success: jQuery.makeArray(args).pop(),
> error: jQuery.makeArray(args).pop()
> });
--
This message was sent by Atlassian JIRA
(v6.2#6252)