Skip to content

[Need comments, low importance] Improve error reporting#6

Open
joshuamegnauth54 wants to merge 6 commits intopop-os:masterfrom
joshuamegnauth54:improve-error-handling
Open

[Need comments, low importance] Improve error reporting#6
joshuamegnauth54 wants to merge 6 commits intopop-os:masterfrom
joshuamegnauth54:improve-error-handling

Conversation

@joshuamegnauth54
Copy link
Contributor

Overview

  • Success and failure messages are sent to the notification daemon if requested (user facing)
  • All errors are printed with tracing instead of panics. ashpd also supports tracing with useful messages
  • Screenshot cancellation doesn't panic anymore

Essentially, 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 on Error. 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 fluent for parity with GNOME and the other COSMIC apps too.

@mmstick
Copy link
Member

mmstick commented Sep 15, 2025

This needs to be rebased. Fluent support was added so that can also be integrated.

joshuamegnauth54 and others added 4 commits September 17, 2025 02:23
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.
@joshuamegnauth54
Copy link
Contributor Author

Alright. I'll work on it and test it this week. 😁

@joshuamegnauth54
Copy link
Contributor Author

I rebased and added localized error strings.

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.

2 participants