Announcement

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

    Correct error message format

    SmartGWT 3.0 FireFox 7.0

    It appears with sgwt 3.0. and not with 2.4.
    I see now with sgwt 3.0. the "WARN:RPCManager:Server returned FAILURE with no error message" in Eclipse Development Mode console and a warning popup window with "Server returned FAILURE with no error message" in the application UI.
    The json-object that is returned from the server looks like that:
    Code:
    {
       "response" : {
          "status" : -1,
          "data" : [
             {
                "errorMessages" : {
                   "friendly_error" : "some error message text"
                }
             }
          ]
       }
    }
    Earlier with sgwt2.4 I did not see the warning popup window. I do not need it because I process such responses in a custom HandleErrorHandler. To prevent this popup to appear I added the "errors" in a response :
    Code:
    {
       "response" : {
          "status" : -1,
    "errors":{"field1":{"errorMessage":"some error message text"}},
          "data" : [
             {
                "errorMessages" : {
                   "friendly_error" : "some error message text"
                }
             }
          ]
       }
    }
    But in vain. I see the same unwanted popup with the same message.
    Could anybody help me to understand how I can prevent this popup appearing by adding a proper error message that is requested by the "with no error message" text? Which is the right format of the error message in a response?

    #2
    Neither format is correct - it's always been wrong and is just being better reported now.

    You should either give the status for validation errors (-4) and provide the errors under the errors property OR use the status for a general unrecoverable error (-1) and provide the error message as a single string under the "data" property.

    Comment


      #3
      Could you please provide a sample (or give me a link to it) of a "the error message as a single string under the "data" property."?
      I tried
      "data" : [{"error":"some error message text"}] but it does not work.
      I tried
      "data" : [{"errorMessage":"some error message text"}] but it does not work too.

      Comment


        #4
        I finally found out that the following format
        {
        "response" : {
        "status" : -1,
        "data" : "some error message text"
        }
        }

        changes a popup window with a "Server returned FAILURE with no error message" message to the popup window with the "some error message text" message.

        But my goal was to prevent this message to appear at all. I would like my custom "HandleErrorHandler" to be invoked but not the default sgwt popup appear. Is it possible?

        Comment


          #5
          I got the answer on my problem in another post http://forums.smartclient.com/showthread.php?p=78807&posted=1#post78807

          I had to add the event.cancel() method at the end of my custom error handler to prevent the default popup appearing.

          Comment

          Working...
          X