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

Bug 423492

Summary: git-status fetch should say "Authentication required", not "Problem while performing the action"
Product: [ECD] Orion Reporter: Adrian Aichner <adrian.aichner>
Component: GitAssignee: Adrian Aichner <adrian.aichner>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: maciej.bendkowski
Version: unspecified   
Target Milestone: 5.0 RC2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
git-status Fetch in expired session: Problem while performing the action
none
Proposed notification on authentication failure none

Description Adrian Aichner CLA 2013-12-07 05:52:59 EST
This is what an orion editor window will report when authentication expires:

Authentication required for: Orion File Service. [Login] and re-try the request.

It's quite clear what needs to be done and I have never lost peding edits due to this.

When I try to fetch latest sources via git-status [Fetch] button, the notification area oracles:

"Problem while performing the action"

This provides no clues whatsoever what may need to be done.

My request is to provide a solution-oriented notification, possibly the same as the editor does.
Comment 1 Adrian Aichner CLA 2013-12-07 05:53:52 EST
Created attachment 238139 [details]
git-status Fetch in expired session: Problem while performing the action
Comment 2 Adrian Aichner CLA 2014-02-02 09:25:00 EST
How about improving this feedback to the user?
Comment 3 Maciej Bendkowski CLA 2014-02-03 05:30:00 EST
(In reply to Adrian Aichner from comment #2)
> How about improving this feedback to the user?

Obviously, error messages like "Problem while performing the action" aren't helping much. Whenever possible, error statuses should describe the nature of the underlying problem. In your specific case, it's way to general. As pointed before, a more descriptive message, e. g. "Authentication required for: Orion Git Service. [Login] and re-try the request" is required. Regardless, this fix seems to be quite trivial. Adrian, would you care to take this bug?
Comment 4 Adrian Aichner CLA 2014-02-03 06:17:54 EST
(In reply to Maciej Bendkowski from comment #3)
> (In reply to Adrian Aichner from comment #2)
> > How about improving this feedback to the user?
> 
> Obviously, error messages like "Problem while performing the action" aren't
> helping much. Whenever possible, error statuses should describe the nature
> of the underlying problem. In your specific case, it's way to general. As
> pointed before, a more descriptive message, e. g. "Authentication required
> for: Orion Git Service. [Login] and re-try the request" is required.
> Regardless, this fix seems to be quite trivial. Adrian, would you care to
> take this bug?

OK, please assign it to me.

These seem to be catch-all messages in exception handlers.

While git takes the lion share, there is one such instance in the Cloud Foundry client as well.
Comment 5 Maciej Bendkowski CLA 2014-02-03 06:26:29 EST
(In reply to Adrian Aichner from comment #4)
> While git takes the lion share, there is one such instance in the Cloud
> Foundry client as well.

Probably git and CloudFoundry are not the only places where incorrect error handling is done. Assinging to you, Adrian.
Comment 6 Adrian Aichner CLA 2014-02-03 10:14:34 EST
Looks like

eclipse.GitService</GitService.prototype._handleGitServiceResponseError@https://my.own.server:8443/orion/git/gitClient.js:971

is the central place to report a better error message.
Comment 7 Maciej Bendkowski CLA 2014-02-03 10:29:01 EST
(In reply to Adrian Aichner from comment #6)
> Looks like
> 
> eclipse.GitService</GitService.prototype.
> _handleGitServiceResponseError@https://my.own.server:8443/orion/git/
> gitClient.js:971
> 
> is the central place to report a better error message.

GitClient only purpose is to serve as an API for XHR calls to the server.
_handleGitServiceResponseError does what would be expected, i. e. passes raw error responses to the caller. In case of git services it would be gitCommands, or further git explorers. Error handling should be done in either gitCommands, or the appropriate explorer.
Comment 8 Adrian Aichner CLA 2014-02-03 14:56:09 EST
This for the guidance, Maciej.

This looks like a better place then, in gitCommands.js:

	exports.createFileCommands = function(serviceRegistry, commandService, explorer, toolbarId) {
		
		function displayErrorOnStatus(error) {

The error has status 401, as expected.

20:41:22.844 console.log(new Error)
20:41:22.851 undefined
20:41:22.853 Error: 
Stack trace:
@debugger eval code:1
displayErrorOnStatus@https://my.own.server:8443/orion/git/gitCommands.js:424
notify@https://my.own.server:8443/orion/Deferred.js:110
run@https://my.own.server:8443/orion/Deferred.js:29

20:43:06.940 JSON.stringify(error, function(key, value) { if (!key || value !== error) return value; }, 2)
20:43:06.947 "{
  "args": {
    "headers": {
      "Orion-Version": "1",
      "Content-Type": "application/json; charset=UTF-8",
      "X-Requested-With": "XMLHttpRequest"
    },
    "timeout": 15000,
    "handleAs": "json"
  },
  "response": "{\"SignInKey\":\"FORMOpenIdUser\",\"SignInLocation\":\"/mixloginstatic/LoginWindow.html\",\"label\":\"Orion workspace server\"}",
  "responseText": "{\"SignInKey\":\"FORMOpenIdUser\",\"SignInLocation\":\"/mixloginstatic/LoginWindow.html\",\"label\":\"Orion workspace server\"}",
  "status": 401,
  "url": "/gitapi/remote/origin/master/file/adrian-OrionContent/org.eclipse.orion.server/",
  "xhr": {}
}"


So my question now is how to report this error very much like
            handleServiceError: function(plugin, error) {
                if (error && error.status === 401) {
                    var headers = plugin.getHeaders();
                    var name = plugin.getName() || plugin.getLocation();
                    var span = document.createElement("span");
                    span.appendChild(document.createTextNode("Authentication required for: " + name + "."));
does in org.eclipse.orion.client.core / web / orion / pluginregistry.js
without duplicating that code.

I guess there should be a common way to report/handle general authentication problems.
Comment 9 Adrian Aichner CLA 2014-02-04 07:52:53 EST
The thing is
org.eclipse.orion.client.core / web / orion / pluginregistry.js
which provides the nice [Login] link in the notification does not use i18n

Should it also use i18n facilities?

gitCommands.js does use i18n, so I could add a message there.

But I would have to add an i18n version of
handleServiceError: function(plugin, error) {
from pluginregistry.js to gitCommands.js.

Is there a way to share the code of handleServiceError between these two modules?
Comment 10 Maciej Bendkowski CLA 2014-02-05 07:05:01 EST
(In reply to Adrian Aichner from comment #9)
> The thing is
> org.eclipse.orion.client.core / web / orion / pluginregistry.js
> which provides the nice [Login] link in the notification does not use i18n
> 
> Should it also use i18n facilities?

A general answer is yes, wherever possible, we should use il18n.

> But I would have to add an i18n version of
> handleServiceError: function(plugin, error) {
> from pluginregistry.js to gitCommands.js.
> 
> Is there a way to share the code of handleServiceError between these two
> modules?

You shouldn't mix two possible authentication issues:
1) Plugins may require external authentication, e. g. a Google drive filesystem requiring access to your drive. This is an external authentication issue.

2) The server crashes while you're running a client command which needs to be authenticated in Orion. This is an internal authentication issue. You can simulate it by navigating to git-repository, stopping Orion and clicking on any git command.

Here, you're focused on the internal authentication issues. Please follow the error control-flow in the second case for gitCommands. As an example, look at handleSshAuthenticationError or handleKnownHostsError. We should be aiming for something similar. There's no problem with il18n since you can use the provided messages map. All we really need are better error messages.
Comment 11 Adrian Aichner CLA 2014-02-05 11:46:00 EST
(In reply to Maciej Bendkowski from comment #10)
> (In reply to Adrian Aichner from comment #9)
> > The thing is
> > org.eclipse.orion.client.core / web / orion / pluginregistry.js
> > which provides the nice [Login] link in the notification does not use i18n

Thanks Maciej this answers all my questions.

I have an initial attempt to improve the error message at
https://github.com/anaran/orion.client/compare/Bug423492?expand=1#diff-ae40690ffdedac9459e336a342d0a34bL425

I was careful enough to keep the tab indentation, but forgot to uncheck
Trim Trailing Whitespace on Save

So, this first commit has a lot of trailing whitespace diffs because the file happened to have them.

If the general direction this patch is going is OK, then I would upgrade the other two instances of function displayErrorOnStatus in that file as well.

See the attachment for how the notification looks now.

What method of review would you prefer?

Thanks,

Adrian


> > 
> > Should it also use i18n facilities?
> 
> A general answer is yes, wherever possible, we should use il18n.
> 
> > But I would have to add an i18n version of
> > handleServiceError: function(plugin, error) {
> > from pluginregistry.js to gitCommands.js.
> > 
> > Is there a way to share the code of handleServiceError between these two
> > modules?
> 
> You shouldn't mix two possible authentication issues:
> 1) Plugins may require external authentication, e. g. a Google drive
> filesystem requiring access to your drive. This is an external
> authentication issue.
> 
> 2) The server crashes while you're running a client command which needs to
> be authenticated in Orion. This is an internal authentication issue. You can
> simulate it by navigating to git-repository, stopping Orion and clicking on
> any git command.
> 
> Here, you're focused on the internal authentication issues. Please follow
> the error control-flow in the second case for gitCommands. As an example,
> look at handleSshAuthenticationError or handleKnownHostsError. We should be
> aiming for something similar. There's no problem with il18n since you can
> use the provided messages map. All we really need are better error messages.
Comment 12 Adrian Aichner CLA 2014-02-05 11:47:02 EST
Created attachment 239667 [details]
Proposed notification on authentication failure
Comment 13 Maciej Bendkowski CLA 2014-02-06 05:16:31 EST
(In reply to Adrian Aichner from comment #11) 
> What method of review would you prefer?

We could go for Gerrit review (see, e. g. http://wiki.eclipse.org/Orion/How_Tos/Using_Gerrit_in_Orion). Please push a proposal with minimal whitespace noise, so it's easier to review.
Comment 14 Adrian Aichner CLA 2014-02-06 06:25:34 EST
(In reply to Maciej Bendkowski from comment #13)
> (In reply to Adrian Aichner from comment #11) 
> > What method of review would you prefer?
> 
> We could go for Gerrit review (see, e. g.
> http://wiki.eclipse.org/Orion/How_Tos/Using_Gerrit_in_Orion). Please push a
> proposal with minimal whitespace noise, so it's easier to review.

While I rework the whitespace issues can you take a look at the github link I sent. That code section is the essential change.
Does that and the screenshot like good?

Thanks, Adrian
Comment 15 Maciej Bendkowski CLA 2014-02-06 06:37:40 EST
(In reply to Adrian Aichner from comment #14)
> While I rework the whitespace issues can you take a look at the github link
> I sent. That code section is the essential change.
> Does that and the screenshot like good?
> 
> Thanks, Adrian

I think it's a good direction, but as mentioned before, I'd like to take a look at the whole change - we should make sure, all error messages are descriptive. Therefore explorers error handling has to be corrected if required. One additional comment: please consider timeout error messages in your fix. In such cases we should have more descriptive statuses.
Comment 16 Adrian Aichner CLA 2014-02-06 19:19:00 EST
(In reply to Maciej Bendkowski from comment #13)
> (In reply to Adrian Aichner from comment #11) 
> > What method of review would you prefer?
> 
> We could go for Gerrit review (see, e. g.
> http://wiki.eclipse.org/Orion/How_Tos/Using_Gerrit_in_Orion). Please push a
> proposal with minimal whitespace noise, so it's easier to review.

I followed the instructions to set up gerrit for the client repo and was able to pull from the gerrit remote.

How do I now request a review of my changes of my newly created Bug423492 branch (eliminates the many whitespace diffs), which are also available at

https://github.com/anaran/orion.client/compare/Bug423492?expand=1

Thanks!
Adrian
Comment 17 Maciej Bendkowski CLA 2014-02-07 12:05:51 EST
(In reply to Adrian Aichner from comment #16)
> How do I now request a review of my changes of my newly created Bug423492
> branch (eliminates the many whitespace diffs)

It's as simple as pushing a commit to a Gerrit remote. Paste the review link in the bug. For more info on how to use Gerrit, you may refer to:

http://wiki.eclipse.org/Orion/How_Tos/Using_Gerrit_in_Orion

Unfortunately, we do not have a review tutorial using Gerrit on our official http://wiki.eclipse.org/Orion/Contributing_Code wiki page. We should open a separate bug for this.
Comment 18 Maciej Bendkowski CLA 2014-02-07 12:09:13 EST
(In reply to Maciej Bendkowski from comment #17)

Pardon me, duplicated link. In order to get familiar with Gerrit, please refer to: http://wiki.eclipse.org/Gerrit.
Comment 19 Adrian Aichner CLA 2014-02-07 19:11:50 EST
(In reply to Maciej Bendkowski from comment #18)
> (In reply to Maciej Bendkowski from comment #17)
> 
> Pardon me, duplicated link. In order to get familiar with Gerrit, please
> refer to: http://wiki.eclipse.org/Gerrit.

Thanks!

My actual stopper was outdated information in
https://wiki.eclipse.org/Orion/Contributing_Code#Commit_your_changes

Leading dashes in
--Signed-off-by: ...
caused gerrit to reject my upload saying
remote: error: The author has not "signed-off" on the contribution.

I amended my commit removing the dashes and gerrit was happy.

I have also updated above wiki page.

Please see
https://git.eclipse.org/r/#/c/21709/
for my proposed change.
Comment 20 Adrian Aichner CLA 2014-02-10 17:37:29 EST
Hi Maciej, just in case this got lot in my chatter, could you please let me know if my gerrit submission looks formally correct?

Please see
https://git.eclipse.org/r/#/c/21709/
for my proposed change.

I just want to avoid a dead lock in case you are expecting something else.

Thanks!
Adrian