filoquin / json-xml-rpc

Automatically exported from code.google.com/p/json-xml-rpc
0 stars 0 forks source link

can not catch the HTTP Code 502 #20

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. server side response  HTTP Code 502  
2. open firebug
3. you can see the exception did not processed by "onException"

What is the expected output? What do you see instead?
502 Code should processed by "onException" function

What version of the product are you using? On what operating system?
version:    r37
Linux and windows
IE 9 ,firefox 10

Please provide any additional information below.

i added some code to fix this problem:
line 337:
                xhr.onreadystatechange = function() {
                    //QUESTION: Why can't I use this.readyState?
                    try{
                        if(xhr.readyState == 4 && xhr.status==200) {
                            if(xhr.status!=200){
                                throw Error(xhr.status + ' '+xhr.statusText );
                            }
                            //XML-RPC
                            if(instance.__protocol == 'XML-RPC') {
                                var response = instance.__getXMLRPCResponse(xhr, requestInfo.id);
                                instance.__doCallback(response);
                            }
                            //JSON-RPC
                            else {
                                var response = instance.__evalJSON(xhr.responseText, instance.__isResponseSanitized);
                                if(!response.id)
                                    response.id = requestInfo.id;
                                instance.__doCallback(response);
                            }
                        }
                    }
                    catch(e){
                        //err.locationCode = PRE-REQUEST Cleint
                        var isCaught = false;
                        if(exceptionHandler)
                            isCaught = exceptionHandler(e);
                        //add error location
                        if(completeHandler)
                            completeHandler();

                        if(!isCaught)
                            throw e;  
                    }
                };

Original issue reported on code.google.com by Mr.Hackie.Chain on 8 Feb 2012 at 9:16