Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SmartGwt 2.5 Nightlies error message

    I'm experimenting with your nightlies for SmartGwt 2.5, and I'm coming across an error message, usually when the app launches initially:

    Code:
    Server returned TRANSPORT_ERROR with no error message
    What is throwing this error and how can I customize the message?

    Thanks

    #2
    Step 1: look at server logs. Post them here if the problem is non-obvious, along with all the other required information.

    Comment


      #3
      My Server logs are not showing any errors relating to this; Even when I look in Firebug, I'm not seeing any requests being sent.

      I have a theory about it though. It seems to be happening when I do not have network connectivity, so this must be what the error means. My question then would be, how do I intercept it on smart gwt client side and send a more accurate error message.

      I'm using RestDataSource. Looking through the API I came across RPCResponse STATUS_TRANSPORT_ERROR. So I'm going to try to experiment with this, to see if i can intercept the error like this.

      Code:
      dataSource.fetchData(criteria, new DSCallback() {
        public void execute(DSResponse response, Object rawData, DSRequest  request) {
          if (response.getStatus()==response.STATUS_TRANSPORT_ERROR) {
              SC.Say("No Network connectivity");
          }
       }
      }
      I'll let you know what happens. Please let me know if on the wrong track :-)

      Comment


        #4
        This is not working. It seems like this is an ERROR that smartgwt is throwing even before getting to the server. Basically because there is no network connectivity. Any Ideas on how I can intercept this and change the error message?

        Comment


          #5
          See the central ErrorHandler you can install on RPCManager.

          Comment


            #6
            Can you please explain more or post a link to this. I've tried Googling "Central ErrorHandler", "SmartGWT ErrorHandler", but no success. I've also looked in your API:
            http://www.smartclient.com/smartgwt/javadoc/index.html?com/smartgwt/client/data/RestDataSource.html

            Please what is a Central ErrorHandler and how do I "Install" it on RPCManager?

            Comment


              #7
              See the error handling section in javadocs.

              Comment


                #8
                I'm still unable to resolve this problem. I've looked at the Error handling code for RPCManager, but I'm not sure how to tie it into my application.

                I'm using RestDataSource and I have this type of code:

                Code:
                final DynamicForm form = new DynamicForm();
                		
                DataSource dataSource = new RestDataSource();	
                
                
                dataSource.setDataURL("data/security-question.js");
                dataSource.setDataFormat(DSDataFormat.JSON);
                		
                final DataSourceField correctlyAnserwed = new DataSourceField("correct", FieldType.BOOLEAN);
                dataSource.setFields(correctlyAnserwed);
                form.setDataSource(dataSource);
                Then in the same class I added this code:

                Code:
                RPCManager.setHandleTransportErrorCallback(new HandleTransportErrorCallback() {
                				
                				public void handleTransportError(int transactionNum, int status, int httpResponseCode, String httpResponseText) {
                					System.err.println("Transaction number: "+transactionNum);
                					System.err.println("Status: "+status);
                					System.err.println("Response code: "+httpResponseCode);
                					System.err.println("Response text: "+httpResponseText);
                					
                				}
                			});

                So because I dont have the file described in setDataUrl, ie "data/security-question.js", a call to dataSource.fetchData() raises a STATUS_TRANSPORT_ERROR in a warn alert window.

                The RPCManager HandleTransportErrorCallback prints out:
                Code:
                Transaction number: 5
                Status: -90
                Response code: 404
                Response text: <html>
                <head>
                <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
                <title>Error 404 NOT_FOUND</title>
                </head>
                <body><h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre>
                ........ etc

                In the javadocs, it says that
                "...you'll typically want to avoid the default error handling response of RPCManager. To do so, set willHandleError to true."

                So please how do I set this value and suppress the alert window, since I'm not using RPCRequest, but I'm sing RestDataSource?

                Thank you.

                Comment

                Working...
                X