Skip to content

Conversation

@leolost2605
Copy link
Member

The first three commits make sure we always set an error instead of returning false for the three package transactions. This way we make sure we never fail silently for the user. Also it simplifies not having to deal with a success variable as well.
There was also bug where != was used instead of ==. The comment said we don't want to overwrite existing errors but the code checked if there was an existing error and if there WAS it overwrote it instead of the other way round.

The fourth commit ignores the return value from the package ops since it will now always return true or set an error so it assumes success if no error is set.

And the last commit is a little cleanup that changes the backend methods to void.

This also serves as preparation for fixing cancelling in a way that we get immediate feedback when cancelling instead of just a flicker that looks like it doesn't cancel.

Can use rebase to merge.

@leolost2605 leolost2605 requested a review from a team October 11, 2025 11:30
@leolost2605 leolost2605 force-pushed the leolost/always-set-error branch from 4ff3d62 to abebc6f Compare October 12, 2025 13:46
@leolost2605 leolost2605 force-pushed the leolost/always-set-error branch from abebc6f to d442f41 Compare October 13, 2025 14:42
@leolost2605 leolost2605 requested a review from tintou October 13, 2025 14:43
Comment on lines -1628 to 1629
job.result = Value (typeof (bool));
job.result.set_boolean (false);
job.error = new IOError.FAILED (_("Component has no flatpak bundle"));
job.results_ready ();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this produce a critical/warning in the console as well?

if (!split_success) {
job.result = Value (typeof (bool));
job.result.set_boolean (false);
job.error = new IOError.FAILED (_("Failed to split package key"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here..?

Comment on lines 498 to 502
try {
return yield perform_operation (State.REMOVING, State.NOT_INSTALLED, state);
yield perform_operation (State.REMOVING);
} catch (Error e) {
throw e;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this method throws an error anyway, you can remove try-catch block here

if (bundle == null) {
job.result = Value (typeof (bool));
job.result.set_boolean (false);
job.error = new IOError.FAILED (_("Component has no flatpak bundle"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

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.

4 participants