Bug 361293 - forbiddenAccessDlg in auth code should be forwarding errors to client rather than using dialog
Summary: forbiddenAccessDlg in auth code should be forwarding errors to client rather ...
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Client (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.3 RC3   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-18 14:41 EDT by Susan McCourt CLA
Modified: 2011-10-20 11:37 EDT (History)
4 users (show)

See Also:
simon_kaegi: review+
mamacdon: review?


Attachments
screenshot of funky dialog (32.01 KB, image/png)
2011-10-18 14:41 EDT, Susan McCourt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Susan McCourt CLA 2011-10-18 14:41:25 EDT
Created attachment 205450 [details]
screenshot of funky dialog

running latest code.
from the workspace root, choose Link Folder, type "foo" and "foo"
(This won't work).
The error is reported in a funky looking dojo dialog even though our client code is trying to report the error in the status area of orion.

Somehow the error is getting swallowed while deep in the bowels of the error callback installed by the service registry.
Comment 1 Susan McCourt CLA 2011-10-19 11:35:52 EDT
Here's some more info that may help in tracking this down.

When using the progress service, some errors are being reported by the "funny dialog" and some are completely being swallowed.  Wondering what the difference in the error reporting is for those cases.

For example, when using "link folder" as described in comment 0, in the current build, the error is reported with the funny dialog.  When the progress service is added, the dialog still comes up.

But an error such as "duplicate folder" when creating a folder that already exists, is currently being reported successfully by the status service, but if you add progress handling, the error gets swallowed by the status service.

Something is different about those two errors that allows one to bring up the dialog, and the other to get swallowed.

The desired behavior is that whether you use the status service to report the error, or use the progress service to track the entire task, any resulting errors would be reported in our client code, not the funny dialog.
Comment 2 Mark Macdonald CLA 2011-10-19 12:34:13 EDT
(In reply to comment #1)
> When using the progress service, some errors are being reported by the "funny
> dialog" and some are completely being swallowed.  Wondering what the difference
> in the error reporting is for those cases.

I think this is from the fail/retry logic that happens in fileClient. It forwards certain error codes to auth.js, and auth puts up the funny dialog in the case of error 403 (Link Folder fail). Other error types (like 412, duplicate folder) don't trigger the dialog. I didn't debug the codepath, but it looks like the 403 gets swallowed in there too -- the promise's error handler is never called.

> The desired behavior is that whether you use the status service to report the
> error, or use the progress service to track the entire task, any resulting
> errors would be reported in our client code, not the funny dialog.

Can we remove "forbiddenAccessDlg" from the auth code entirely? I think it was a stopgap solution for when we had literally no other error handling, and it's unnecessary now. Anyone else know?
Comment 3 Simon Kaegi CLA 2011-10-19 13:25:55 EDT
The 403 is getting swallowed in auth.js -- to be honest not sure this is at all right and even if the fileClient should be sending 403 errors to the authhandler.

With that disabled I see no error handler in the createProject call on line 496 if fileCommands.
Comment 4 Susan McCourt CLA 2011-10-19 15:26:58 EDT
(In reply to comment #2)
> Can we remove "forbiddenAccessDlg" from the auth code entirely? I think it was
> a stopgap solution for when we had literally no other error handling, and it's
> unnecessary now. Anyone else know?

(In reply to comment #3)
> The 403 is getting swallowed in auth.js -- to be honest not sure this is at all
> right and even if the fileClient should be sending 403 errors to the
> authhandler.

Looks like we need to get rid of this funny dialog and just ensure that the proper error gets reported back so that any progress handling or status message code can report it in the expected place.

The end result should be that "Link Folder" on orion.eclipse.org reports the error in the status area.

> 
> With that disabled I see no error handler in the createProject call on line 496
> if fileCommands.

The rest of the "swallowing" problem was an error in my assumptions about the progress handler error reporting.  See bug 361006 if you care.

Bottom line:  not urgent for RC3 but we should clean this up.
Comment 5 Mark Macdonald CLA 2011-10-19 15:47:54 EDT
(In reply to comment #4)

I pushed a topic branch [1] with a fix that removes the funny dialog and uses the status service for reporting progress & errors on all the stuff in fileCommands. But then I read bug 361006, and realized this overlaps with the changes you're making there...

[1] http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?h=bug361293_status&id=73d61da894b16f8eae83124833a7349c23d808f5
Comment 6 Susan McCourt CLA 2011-10-19 15:54:34 EDT
(In reply to comment #5)
> (In reply to comment #4)
> 
> I pushed a topic branch [1] with a fix that removes the funny dialog and uses
> the status service for reporting progress & errors on all the stuff in
> fileCommands. But then I read bug 361006, and realized this overlaps with the
> changes you're making there...
> 
> [1]
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?h=bug361293_status&id=73d61da894b16f8eae83124833a7349c23d808f5

I like your solution, at least caching the error handler makes the code less complicated.  And if we still decide that we want to have the progress handler do error calling for free, it's a small change to do that.

Simon, do you like this for RC3?
Basically it gets rid of the funny dialog and adds error handling where we didn't have it (new project)
Comment 7 Mark Macdonald CLA 2011-10-19 16:09:18 EDT
Correction, the branch link should be:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/log/?h=bug361293_status

(I hosed the commit from Comment 5, sorry)
Comment 8 Simon Kaegi CLA 2011-10-19 16:11:00 EDT
I'm fine with this but get Mark to review and get the best fix in.
Comment 9 Susan McCourt CLA 2011-10-19 18:16:14 EDT
+1.
Not only does this fix get rid of the dialog, but it adds proper error reporting to cases where we were doing nothing before.  Tested this with:

- new folder failure
- new file failure
- copy failure
- move failure
- link failure

Also tested the case where you log out of the navigator, and then try the operation and it works as it should.  You get the login popup, login, then back to the page and operation completes.

Nice fix.
Comment 11 Malgorzata Janczarska CLA 2011-10-20 09:10:27 EDT
Mark,
this fix removed handling of 403 in any service other than fileService.
Search the client code for "403", you'll see that there are still services rely of 403 handling on auth.js:
* sites
* users
* git
To reproduce go to user profile and change hash for a different user id. 403 is thrown but you get no error on UI.

The leftovers still use auth.js, so maybe you could do common 403 error handling there?
Comment 12 Simon Kaegi CLA 2011-10-20 10:20:46 EDT
+1 to just fixing the problems for FileService and leaving/rolling back the rest of the 403 handling as is in auth.js.
Comment 13 Mark Macdonald CLA 2011-10-20 10:59:53 EDT
(In reply to comment #11)
> Mark,
> this fix removed handling of 403 in any service other than fileService.
> Search the client code for "403", you'll see that there are still services rely
> of 403 handling on auth.js:
> * sites
> * users
> * git
> To reproduce go to user profile and change hash for a different user id. 403 is
> thrown but you get no error on UI.
> 
> The leftovers still use auth.js, so maybe you could do common 403 error
> handling there?

Yikes, thanks for pointing this out.

It would be better for the consumers of these services to handle errors, but since I can't guarantee that they do, I'll go the safe route and revert auth.js.

Aside: I'm not even sure how to generate 403s for some of these cases -- I think we copied fileClient's 401/403 treatment too eagerly. I'm sure that's what happened in the sites case, at least.
Comment 15 Mark Macdonald CLA 2011-10-20 11:37:55 EDT
(In reply to comment #11)
> To reproduce go to user profile and change hash for a different user id. 403 is
> thrown but you get no error on UI.

Just a note -- this case is independently broken. the forbidden access dialog expects a JSON error, but we're getting an HTML string back from the server here.