Opened 15 years ago

Closed 15 years ago

#304 closed defect (fixed)

unknown error when zoom with disconnected server connection

Reported by: christinebao Owned by: madair
Priority: P2 Milestone: Future
Component: Core Version: 1.1.1
Severity: Major Keywords: Failover
Cc: Jenny, He Browser: All
External ID: 1250151 Operating System: All
state: New

Description

  1. open flexible weblayout in IE
  2. plug network cable on MapGuide Server
  3. zoom in the map

Result: Error message pops up with simple word: Unknown

Expected: friendly error message brings.

Comments: In fusion, the error message isn't also that friendly, see below:
Fusion Error: Warning exception occurred in AJAX callback. Message: syntax error Location: http://xxx/mapguide2010/fusion/lib/fusionSF-compressed.js(1) Response:

Attachments (3)

ErrorMsg.JPG (46.4 KB ) - added by christinebao 15 years ago.
ErrorHandler.patch (812 bytes ) - added by christinebao 15 years ago.
RefineErrorMsg.patch (781 bytes ) - added by christinebao 15 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 by madair, 15 years ago

Status: newassigned

I havign trouble reproducing the conditions for the first issue because I can't "plug netwrok cable on MapGuide Server" (I assume you mean unplug?). My mapGuide runs on the same machine as Fusion. If I stop the MapGuide service, I get a popup with a very user-friendly error message.

For the Ajax callback error, what would you like for the message?

comment:2 by christinebao, 15 years ago

QA can still reproduce the defect by unplugging network. The error dialog is as the attached image (ErrorMsg.JPG) shows.
This is different than stopping MapGuide server. If stop MapGuide server, and MgConnectionFailedException returned, and there is user-friendly message.

by christinebao, 15 years ago

Attachment: ErrorMsg.JPG added

comment:3 by christinebao, 15 years ago

Cc: Jenny He added

The error message of this defect is:

comment:4 by christinebao, 15 years ago

Tech diagnosis:

Typically an error is handled in this way:

  1. If an exception occurs in MapGuide server, the server will throw out exception, and web tier will translate it into an HTML page, for example:
<html>
<head>
<title>MgDbException</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
</head>
<body>
<h2>An exception occurred in DB component.</h2>
An exception occurred in DB component.
</body>
</html>


  1. Fusion get the response, and put the HTML content into its error handler.

        xml2json: function(callback, r, json) {
          if (json) {
            var o;
            eval("o="+r.responseText);
            callback(o);
          } else {
          if (r.status >= 400) {
              Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,
                  'xml2json: invalid XML document: ' + r.transport.responseText + " : " + r.request.url));
              return;
          }


  1. MapGuide template deals with the error handling string, get the readable message by parsing <h2></h2>.
var fusionError = function(eventId, error) {
    var errorMessage = error.toString();
    var readableMessage = '';

    //Case 1: For dealing with Function: convertXML (fusion.js)
    //******************************************
    //        xml2json: function(callback, r, json) {
    //      if (json) {
    //        var o;
    //        eval("o="+r.responseText);
    //        callback(o);
    //      } else {
    //      if (r.status >= 400) {
    //          Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,
    //              'xml2json: invalid XML document: ' + r.transport.responseText + " : " + r.request.url));
    //          return;
    //      }
    //******************************************
    var tagStart = '<h2>';
    var tagEnd = '</h2>';
    var indexStart = errorMessage.indexOf(tagStart);
    var indexEnd = errorMessage.indexOf(tagEnd, tagStart);
    if (indexStart != -1 && indexEnd != -1) {
        readableMessage = errorMessage.substring(indexStart + tagStart.length, indexEnd);
        readableMessage = readableMessage.replace(/\\n/g, '\n');
        readableMessage = readableMessage.replace(/\\t/g, '\t');
    }

Then a user-friendly error message pops up.

comment:5 by christinebao, 15 years ago

However in this defect the server machine's network is unplugged, and there is no exception message return from server. Thus when fusion deal with response, r.transport.responseText is empty. Please see the ErrorMsg.JPG, it is the result of formatted string from fusion.

Because the error content doesn't include <h2></h2>, MapGuide template can't parse a readable message, and the whole string show as error message.

by christinebao, 15 years ago

Attachment: ErrorHandler.patch added

comment:6 by christinebao, 15 years ago

Attach patch http://trac.osgeo.org/fusion/attachment/ticket/304/ErrorHandler.patch for fixing this defect. Please review.

comment:7 by christinebao, 15 years ago

Hi madair,

Would you please review the patch? The string is hard coded, would you please put it into resource file (as I'm not familiar with it). Thank you.

comment:8 by madair, 15 years ago

the pathc looks good and it looks like it was already applied. I will move the string into the resource bundle.

by christinebao, 15 years ago

Attachment: RefineErrorMsg.patch added

comment:9 by christinebao, 15 years ago

Hi madair,

Thank you for reviewing. The error message is refined according to Tech Pub's suggestion. Please see the patch http://trac.osgeo.org/fusion/attachment/ticket/304/RefineErrorMsg.patch.

Would you please move the string to resource file as soon as possible? In this week MapGuide may make branch for beta, so it's appreciated to make the code change sooner. Thank you in advance!

comment:10 by madair, 15 years ago

Resolution: fixed
Status: assignedclosed

strings moved to the resource bundle.

closing this issue but if I've missed something please re-open.

Note: See TracTickets for help on using tickets.