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

Improvements to error catching and reporting #649

Merged
merged 17 commits into from
Feb 26, 2022

Conversation

tleedjarv
Copy link
Contributor

This is a collection of bug fixes and improvements to various error situations. There are several independent changes and bug fixes, the major part is the fix to #442, keeping the GUI alive after any "fatal" errors. The bug fixes and improvements are not GUI-specific.

It could be possible to merge several of the commits independently, if needed.

Fixes #442

For reviewers

The number of commits is large to assist in reviewing (the first 8 commits are step-by-step preparations before the big GUI commit). Most of them will be squashed before merging. Each commit indicates git options that may be helpful when reviewing that commit. While it may be easier to review commit-by-commit, reviewing several at a time, or even everything together, should be reasonably simple and effortless (it turns out that GitHub does a mostly decent job displaying the diff).

It is clearly based on a CLI's needs.

 - remove unused parameter
 - split Uicommon.uiInit into two and simulate old Uicommon.uiInit by
   sequencing the two stages

Hint:
  could be reviewed individually or combined with the next commit (the
  latter may even be better for seeing what's going on)

  the following git options may help when reviewing

  --color-moved=blocks
 - remove Uicommon.uiInit and call split stages directly

Hint:
  could be reviewed individually or combined with the previous commit
  (the latter may even be better for seeing what's going on)

  the following git options may help when reviewing

  --color-moved=blocks
 - eliminate Uicommon.uiInitStage2 completely, moving common parts
   (only initPrefs) to uitext and uigtk2, respectively; the remaining
   parts are moved to uitext

this commit is intentionally not compiling, to show the changes better

Hint:
  the following git options may help when reviewing

  --color-moved=blocks --color-moved-ws=ignore-space-change
make the previous commit compile

Hint:
  the following git options may help when reviewing

  --word-diff=plain
 - let each UI (not the common code) decide when to interact with the
   user and when to exit -- replace explicit callbacks and [exit] calls
   with an Ok/Error result type
 - implement uitext first

Hint:
  the following git options may help when reviewing

  --word-diff=plain
 - same as previous, implement uigtk2

Hint:
  the following git options may help when reviewing

  --color-moved=blocks --color-moved-ws=ignore-space-change
Previously the changes were kept to a minimum, just to highlight code
moves better. Now clean up the resulting code, starting with uicommon...

Hint:
  the following git options may help when reviewing

  --word-diff=plain  (or just -w)
... and continuing with uitext.

Hint:
  the following git options may help when reviewing

  --word-diff=plain
found in older code; not directly related to the restructuring
Add a Close button to the fatal error message dialog. Clean up and
structure the code to either leave the GUI in the neutral state and
allow the user to try again or change the profile; or force a profile
change if still in the early init process.

Clean up global state and guard the code against continuing after an
interrupted action.

Hint:
  the following git options may help when reviewing

  -w --color-moved=blocks --color-moved-ws=ignore-all-space
Previously, an error during initial scanning the profiles would force
the user interface to quit without user being able to rectify the
situation (indeed, nor even understand what is going on). This would
happen at an error in _any_ profile, not just the one the user had
requested.

Since this scanning is only done to build a list of profiles for the
profile manager, we can safely ignore any errors at this stage (while
still notifying the user).
By default, this early in the init process, the application would just
quit. These warnings are not fatal errors, nor are they relevant at this
stage. Just print out the warning and continue normally.
This is to better organise code and not force scanning the profiles
before the GUI is built (any error/warning during the scanning would
then go lost or force the exit before the GUI is even built).

Later, should be updated to update the menu every time profile manager
was opened (because profiles may have been added/removed/changed).
Some connection errors were reported twice, first as a warning and then
a fatal error. Make them what they really are - fatal errors - and
report only once.

Hint:
  the following git options may help when reviewing

  --word-diff=plain
... and actually report nice errors to the user, rather than just fail
with an uncaught exception and a backtrace. While the bulk of this
change is in the GUI, the resiliency and error reporting applies to CLI
as well.

Hint:
  the following git options may help when reviewing

  --color-moved=blocks --color-moved-ws=ignore-space-change
Move commit logs processing to the earliest moment after roots have been
installed. Moved path expansion closer to prefs propagation, just for
logical grouping.

Hint:
  the following git options may help when reviewing

  --color-moved=plain --color-moved-ws=ignore-all-space
@tleedjarv tleedjarv marked this pull request as ready for review February 25, 2022 19:01
@gdt gdt merged commit f4b4202 into bcpierce00:master Feb 26, 2022
@tleedjarv tleedjarv deleted the gui-fatal-error branch February 26, 2022 17:28
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 this pull request may close these issues.

GUI: do not quit on error
2 participants