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

Bug 389034

Summary: Error reporting for disconnected and not logged in state
Product: [ECD] Orion Reporter: Maciej Bendkowski <maciej.bendkowski>
Component: ClientAssignee: Susan McCourt <susan>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: antonm, ken_walker, libingw, maciej.bendkowski, mamacdon, simon_kaegi
Version: unspecifiedFlags: mamacdon: review+
Target Milestone: 1.0 RC2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 391470    
Bug Blocks:    
Attachments:
Description Flags
Java net UnknowHost error none

Description Maciej Bendkowski CLA 2012-09-07 06:26:29 EDT
Created attachment 220833 [details]
Java net UnknowHost error

I lost internet access while trying to fetch from a remote and I've noticed the error message slideout (see attachment). I think we shouldn't pass the internal java error type in a raw form to the client, like java.net.UnknownHost. Such errors should be somehow decorated or even hidden.
Comment 1 Susan McCourt CLA 2012-09-07 13:14:11 EDT
(In reply to comment #0)
>Such errors should be somehow decorated or even hidden.

I'm all for nicer error messages, such as "could not find github.com" instead of "unknown host", but I would definitely want an error to be reported for this case.
Comment 2 Susan McCourt CLA 2012-09-18 12:19:47 EDT
Simon mentioned in today's UX call that he would like an error handler for unknown host when you try to save in the editor.  I told him I'd look at it.  I'll try to put a generic error handler somewhere that we could use for any command that reports unknown host in a nice way (you appear to be disconnected)...
Comment 3 Ken Walker CLA 2012-09-18 12:29:00 EDT
If you self host, open a file on the self hosted site and edit it, then stop the self hosted site and try to save.  There is a 404 generated in fileImpl.js:318
Comment 4 Susan McCourt CLA 2012-10-02 14:31:30 EDT
(In reply to comment #3)
> If you self host, open a file on the self hosted site and edit it, then stop
> the self hosted site and try to save.  There is a 404 generated in
> fileImpl.js:318

The 404 is a bit of a different case because the site support generates this.

If you unplug your network connection and then try to save an editor change, you never get any kind of error response, it's being swallowed somewhere.  I traced it from our fileClient.write to the fileImpl, all the way down into our implementation of xhr.  The timeout event is never called on the XHR, there's no error coming out of that call.   I'm not really sure where to take this.
Comment 5 Susan McCourt CLA 2012-10-02 14:47:59 EDT
Talked to Mark.  He's going to look at this one.  One theory is that the browser's XHR doesn't fire a timeout event when the connection is never opened.

I'll also look at other cases.  Seems we should handle:
- user is truly disconnected
- user is connected but host wasn't found
- user is connected but not logged in
Comment 6 Mark Macdonald CLA 2012-10-02 15:41:28 EDT
(In reply to comment #5)
> Talked to Mark.  He's going to look at this one.  One theory is that the
> browser's XHR doesn't fire a timeout event when the connection is never
> opened.

Turns out that WebKit doesn't support the XMLHttpRequest.timeout property, which orion/xhr relied on. It is now emulated using setTimeout if necessary:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=2044f9440636f4bb83531b3c52386cd4d2244117
Comment 7 Susan McCourt CLA 2012-10-03 11:58:21 EDT
There's still something not right here.
I can see the timeout firing now, but we never get to the error handler of the caller.  I put a breakpoint on the "then" of the deferred and it is not hit.  At first I thought the deferred is already resolved by the time the timeout triggers, but I'm not sure.  I can step through the reject code in Deferred but it never makes it back to the caller.
Comment 8 Mark Macdonald CLA 2012-10-04 17:07:01 EDT
Errors should now be reported in the editor status line after the save fails. If the server is down, you see a message saying "No response from server".

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=1241a78239e40fa1640062f6ac750243441a52fb
Comment 9 Mark Macdonald CLA 2012-10-04 17:09:51 EDT
I think we're good here for now. Susan, feel free to open a bug and we can iterate on this in RC2 if there's more to do.
Comment 10 Mark Macdonald CLA 2012-10-04 22:58:26 EDT
> Susan F. Mccourt: you can send that bug back to me, i think we should be using the progress service
> 10:54:17 PM: Susan F. Mccourt: (which will make a more permanent error, and let us put links in it)
Comment 11 Susan McCourt CLA 2012-10-08 15:01:19 EDT
I added code to use the progress result reporting (error slideout) to handle the error case, and to include a link to the login page when the server does not respond.

Mark, can you review/cherry pick/release?
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=71eb36556b25209108b831f0552a35c7c2112fcd

The change includes a change to the message service so that HTML messages get the same styling as their plain text counter parts.

When the user is truly disconnected, the login link won't really help, but it's something they can try.

We still have a problem that 401/Unauthorized isn't making its way back to the client at all.  I'd like to add similar error handling for 401 (link to login page) but need some help figuring out what happened to the error.

Mark?
Comment 12 Susan McCourt CLA 2012-10-08 15:02:29 EDT
The 401 shows up in the network debug tab on chrome, but no exception is received in the xhr code.
Comment 13 Susan McCourt CLA 2012-10-09 12:07:49 EDT
(In reply to comment #11)
> Mark, can you review/cherry pick/release?
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/
> ?id=71eb36556b25209108b831f0552a35c7c2112fcd

remote branch is called "disconnectedErrors"
Comment 14 Mark Macdonald CLA 2012-10-09 15:26:38 EDT
(In reply to comment #12)
> The 401 shows up in the network debug tab on chrome, but no exception is
> received in the xhr code.

fileClient passes off the 401 to auth.handleAuthenticationError(), but that call throws an exception because of bug 391470. The 401 is lost due to the exception. Libing is fixing 391470 and I am pushing a fix for fileClient to make it tolerant of auth-code exceptions -- rejected fileService calls should never be swallowed from now on.
Comment 15 Susan McCourt CLA 2012-10-09 15:56:29 EDT
Thanks, Mark.

Okay.  That means that we'll get the little "log in" popup again, so there's no need for a login link to appear in the progress bar.  I will rework the solution for "disconnected" state so that it doesn't try to link you to login.  I'll ping you again when there's something for review.
Comment 16 Susan McCourt CLA 2012-10-10 11:19:21 EDT
The commit is
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=af45c3402a0ec173a0f5bcd2316561dc39ea5f11

Git Log kept 404'ing when I tried to push this to a remote branch.  I tried the original branch and a new branch.  I pushed to master in frustration.
Comment 17 Susan McCourt CLA 2012-10-11 10:43:06 EDT
fixed.