-
-
Notifications
You must be signed in to change notification settings - Fork 105
Package transactions: Always set error #2363
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
base: main
Are you sure you want to change the base?
Conversation
4ff3d62 to
abebc6f
Compare
false is never returned because instead an error is thrown
abebc6f to
d442f41
Compare
| job.result = Value (typeof (bool)); | ||
| job.result.set_boolean (false); | ||
| job.error = new IOError.FAILED (_("Component has no flatpak bundle")); | ||
| job.results_ready (); |
There was a problem hiding this comment.
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")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here..?
| try { | ||
| return yield perform_operation (State.REMOVING, State.NOT_INSTALLED, state); | ||
| yield perform_operation (State.REMOVING); | ||
| } catch (Error e) { | ||
| throw e; | ||
| } |
There was a problem hiding this comment.
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")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
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.