[Need comments, low importance] Improve error reporting#6
Open
joshuamegnauth54 wants to merge 6 commits intopop-os:masterfrom
Open
[Need comments, low importance] Improve error reporting#6joshuamegnauth54 wants to merge 6 commits intopop-os:masterfrom
joshuamegnauth54 wants to merge 6 commits intopop-os:masterfrom
Conversation
63bb42f to
544b1da
Compare
Member
|
This needs to be rebased. Fluent support was added so that can also be integrated. |
First pass at improving error handling. `cosmic-screenshot` currently panics for every error. This isn't ideal for a user facing app that won't be launched from a terminal. The program also panics on cancellation. A better idea is to leverage notifications for a few important messages e.g. successful screenshots or common failures. Full error messages can be logged with `tracing` in case something is broken.
Contributor
Author
|
Alright. I'll work on it and test it this week. 😁 |
544b1da to
d0fac8d
Compare
d0fac8d to
c6b0be5
Compare
Contributor
Author
|
I rebased and added localized error strings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
tracinginstead of panics.ashpdalso supportstracingwith useful messagesEssentially, I refactored error handling to not panic but instead log errors and send status notifications. Error messages for users (the notifications) are less verbose than the logged messages. This is the
to_user_facing()function onError. For example, if screenshots or specific screenshot features are unsupported by the portal (i.e. if the user is using a different portal for screenshots), then a "Portal does not support screenshots" notification is posted.Todo
I implemented the main changes already, but I would like to check if this patch is desirable and, if so, what I should do to improve it. The user facing messages should be probably be cleaned up or maybe even reduced. I also noticed that GNOME translates its screenshot errors. I can add
fluentfor parity with GNOME and the other COSMIC apps too.