Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 508142

Summary: Show and error message when require-config.js fails to load
Product: [ECD] Orion Reporter: Steve Northover <steve_northover>
Component: ClientAssignee: Eric Moffatt <emoffatt>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: grant_gayed, libingw, Michael_Rennie, Silenio_Quarti
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/88204
Whiteboard:
Attachments:
Description Flags
RequireJS timeout none

Description Steve Northover CLA 2016-11-24 11:58:33 EST
When there is a splash screen and require.js fails to load, it just sits there forever (see attached image).  

When a randpm user sees the problem, they often don't know to open up the debug console and look for errors.  They report that Orion is hung.

Let's investigate these sorts of errors and at least notify the user, provide the error text so that if/when this happens again, they know to refresh.
Comment 1 Steve Northover CLA 2016-11-24 11:59:47 EST
Created attachment 265566 [details]
RequireJS timeout
Comment 2 Michael Rennie CLA 2016-11-24 12:42:56 EST
There actually is a dialog that will show up and tell you loading failed. I have seen it from time to time. Libing, I think you were the one that added that notification support? Can you elaborate more?
Comment 3 Steve Northover CLA 2016-11-24 12:58:09 EST
We never want to be in a state where we are waiting forever for the splash screen because of an error and the user is not informed of the error.
Comment 4 Silenio Quarti CLA 2016-11-24 13:00:57 EST
The dialog does not show when loading the require-config.js module. The error dialog code is in that module. We need to add a error handle when loading require-config.js, which means the code needs to be replicated in all our page htmls (sigh). It cannot be shared. Or we have to load it the old fashion way as a script (not requirejs).

Also, the require-config.js module increases the requirejs loading timeout. But require-config.js is loaded using the default timeout (7 seconds) which maybe too short. If we want to increase the timeout for requrie-config.js, we also need to duplicate the code on all pages.
Comment 5 Michael Rennie CLA 2016-11-24 15:38:40 EST
(In reply to Silenio Quarti from comment #4)
> The dialog does not show when loading the require-config.js module. The
> error dialog code is in that module. We need to add a error handle when
> loading require-config.js, which means the code needs to be replicated in
> all our page htmls (sigh). It cannot be shared. Or we have to load it the
> old fashion way as a script (not requirejs).
> 

Yeah, everywhere we require require-config we would need to add code like:

function(err) {
  switch(err.requireType) {
    case "timeout": {
      //TODO undef it and try again?				
      break;
    }
    case "nodefine": {
      //TODO tried to load something unknown
      break;
    }
    case "scripterror": {
      //TODO forward the details - would help a lot for module problems
      break;
    }
    default: {
      //TODO catch-all, let the user know and react
    }
  }
}
Comment 6 Steve Northover CLA 2016-11-24 16:54:07 EST
Or just say, "Oops ... we failed to load the page" and give the horrible error text in smaller font for people that want to enter a bug or to help us debug.
Comment 7 Steve Northover CLA 2016-11-28 15:47:26 EST
Eric?  This one is important because we look like idiots when we fail.  It has failed in front of Dave.
Comment 8 Steve Northover CLA 2016-12-16 12:26:18 EST
What happened about this?  When it happens, it is horrible and people think that we are crap rather than the network connection was bad etc.
Comment 9 Eclipse Genie CLA 2017-01-06 15:02:31 EST
New Gerrit change created: https://git.eclipse.org/r/88204
Comment 10 Eric Moffatt CLA 2017-01-19 15:50:39 EST
OK, I've just pushed the changes that make the requiring of 'require-config' show an alert much like the alert the require-config itself uses. I've also updated the message displayed in require-config to show the 'Please try to reload the page' first (since that's what the user needs to see most.
Comment 11 Steve Northover CLA 2017-01-19 15:58:47 EST
Would like to see a demo of the failure and the message.  Thanks.
Comment 12 Eric Moffatt CLA 2017-01-24 14:26:43 EST
Need to reopen to take another approach...
Comment 13 Eric Moffatt CLA 2017-01-24 14:28:06 EST
OK I've just checked in a fix that adds a non-'required' error handler. It's used not only for the require-config but is lso used for all subsequent load errors.

Commit:

https://git.eclipse.org/c/gerrit/orion/org.eclipse.orion.client.git/commit/?id=85391f189766ae5747637d3be35f2d9a1f885869
Comment 14 Eric Moffatt CLA 2017-01-24 14:29:02 EST
Fixed by the previous commit
Comment 15 Grant Gayed CLA 2017-01-24 16:22:17 EST
I think Beta3 is now broken from this change.  It doesn't get past the splash screen and spews to the console:

require-config.js:17Uncaught ReferenceError: errback is not defined
    at require-config.js:17
    at Object.execCb (require.min.js:29)
    at Z.check (require.min.js:18)
    at Z.enable (require.min.js:23)
    at Z.init (require.min.js:17)
    at E (require.min.js:14)
    at Object.completeLoad (require.min.js:28)
    at HTMLScriptElement.onScriptLoad (require.min.js:29)
Comment 16 Steve Northover CLA 2017-01-24 16:25:09 EST
Please back out the change.
Comment 17 Silenio Quarti CLA 2017-01-24 16:34:05 EST
The code is running fine in orion.eclipse.org.
Comment 18 Eric Moffatt CLA 2017-01-26 14:49:39 EST
OK, the code is in and things seem to be running ok. I'll wait until the code gets deployed to PROD and then mark this as VERIFIED.