Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide contextual error messages, not “Internal exception occurred” #219

Closed
bignose-debian opened this issue Sep 4, 2016 · 8 comments · Fixed by #865
Closed

Provide contextual error messages, not “Internal exception occurred” #219

bignose-debian opened this issue Sep 4, 2016 · 8 comments · Fixed by #865
Assignees
Milestone

Comments

@bignose-debian
Copy link

In many failure scenarios (e.g. issue #153, issue #162, and others) the app presents a raw message from the jgit library.

The jgit library messages are very low-level, and the message presented to the user is lacking important context from the Password Store app about what it was doing when the jgit library raised an exception.

Please catch jgit library exceptions, at each point where useful contextual information from Password Store can be presented in a more useful diagnostic error message.

@zeapo
Copy link
Contributor

zeapo commented Nov 1, 2016

Can we list all the different cases that need to be handled? This will be transferred into a PR once we start working on it.

@bignose-debian
Copy link
Author

On 01-Nov-2016, Mohamed Zenadi wrote:

Can we list all the different cases that need to be handled?

I think the comprehensive approach is not to enumerate failure cases,
but to enumerate the places in the code where the jgit library is
used.

Any use of jgit should catch jgit exceptions, and provide context at
that point about what was being done when the exception occurred.

So the list of tasks is IMO to be found by enumerating all the
distinct code locations that use jgit to do some action.

Catch any jgit exception that occurs at that location. Annotate the
resulting message with “I was doing this specific action when a jgit
exception occurred”.

The “this specific action” should be whatever the user needs to know
to tell developers exactly what caused a jgit exception.

This will be transferred into a PR once we start working on it.

Thanks.

\ “Consider the daffodil. And while you're doing that, I'll be |
`\ over here, looking through your stuff.” —Jack Handey |
o_) |
Ben Finney ben@benfinney.id.au

@zeapo
Copy link
Contributor

zeapo commented Nov 6, 2016

Well, in fact there is a single place where jgit is used https://github.com/zeapo/Android-Password-Store/blob/master/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java#L65-L85

That's the place where we ought to handle the different cases. The command being handled is known at https://github.com/zeapo/Android-Password-Store/blob/master/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java#L42 and the result is returned in as a String. We have to change that to send back a combination of Cmd/jgit exception so that the post processing knows how to give a feedback.

The list I started to define earlier is only meant for a better description / documentation of the issue. We also have to check in eclipse git plugin how the implemented exceptions handling for jgit errors.

The issue here is that the project in its current state is not easily maintainable, a lot of refactoring has to be done, and I have not much time to do it on my own.

@bignose-debian
Copy link
Author

On 06-Nov-2016, Mohamed Zenadi wrote:

Well, in fact there is a single place where jgit is used
https://github.com/zeapo/Android-Password-Store/blob/master/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java#L65-L85

Thanks. If I understand correctly, that is a wrapper to execute the
command asynchronously, and has no context about why the command is
being executed.

So I think that location in the code does not have the context
needed to provide useful diagnostic information.

The command being handled is known at
https://github.com/zeapo/Android-Password-Store/blob/master/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java#L42
and the result is returned in as a String. We have to change that
to send back a combination of Cmd/jgit exception so that the post
processing knows how to give a feedback.

I think the exception should not be caught in that function; as you
say, it knows only the command, and not the user operation which
caused that command.

Instead, the exception should propagate to a point where the code
does know the user action that led to that Git command.

The list I started to define earlier is only meant for a better
description / documentation of the issue.

As a rough guide – and, importantly, an easy criterion – I would say a
complete set of locations where useful contextual information about
the user action is known:

All the places in the code that invoke a GitAsyncTask. Catch the
exception and provide diagnostic information about what Password Store
was doing (i.e. why it needed a GitAsyncTask).

That can be refined further, but it would at least be complete :-) and
need no difficult choices at first.

The issue here is that the project in its current state is not
easily maintainable, a lot of refactoring has to be done, and I have
not much time to do it on my own.

I don't know Java at all well. Thank you for maintaining this project.

I'm making these suggestions to hopefully improve the diagnostic
information without a lot of redesign, which in turn should make the
bug reports easier to understand.

\ “For every complex problem, there is a solution that is simple, |
`\ neat, and wrong.” —Henry L. Mencken |
o_) |
Ben Finney ben@benfinney.id.au

@zeapo
Copy link
Contributor

zeapo commented Nov 6, 2016

Thanks for your comments.

One way I could do that is by passing a callback to the GitAsyncTask to be called in onPostExecute with the exception. That way we could handle it from the calling activity.

@bignose-debian
Copy link
Author

On 06-Nov-2016, Mohamed Zenadi wrote:

One way I could do that is by passing a callback to the
GitAsyncTask to be called in onPostExecute with the exception.
That way we could handle it from the calling activity.

Sounds fine to me, I'll trust you with knowing the techniques :-)

\ “If you can't beat them, arrange to have them beaten.” —George |
`\ Carlin |
o_) |
Ben Finney ben@benfinney.id.au

@zeapo zeapo mentioned this issue Nov 12, 2016
6 tasks
@zeapo
Copy link
Contributor

zeapo commented Nov 12, 2016

This is being worked on :)

@hughdavenport
Copy link

What was left to work on for this one @zeapo ?

@msfjarvis msfjarvis added this to the 1.10.0 milestone Jun 20, 2020
@msfjarvis msfjarvis linked a pull request Jun 20, 2020 that will close this issue
8 tasks
@msfjarvis msfjarvis removed this from the 1.10.0 milestone Jul 16, 2020
@msfjarvis msfjarvis added this to the 1.11.0 milestone Aug 1, 2020
@msfjarvis msfjarvis self-assigned this Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants