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

JobResult::error doesn't result in message box #1600

Closed
ollieparanoid opened this issue Dec 18, 2020 · 3 comments
Closed

JobResult::error doesn't result in message box #1600

ollieparanoid opened this issue Dec 18, 2020 · 3 comments

Comments

@ollieparanoid
Copy link

ollieparanoid commented Dec 18, 2020

I would have expected that returning JobResult::error in a job's exec() opens a message box and shows the error to the user. However, with this job I wrote:

https://github.com/calamares/calamares-extensions/blob/0d057478b026de73aaa5be2df9ea4a01231818ab/modules/mobile/PartitionJob.cpp#L110

...the error is written to the log, but not shown to the user. Calamares then continues with the next job, mount in my case, and this one fails here and does show a message box to the user:

_("No partitions are defined for <pre>{!s}</pre> to use." ).format("mount"))

The first error message would have been much more useful, the second is rather irritating because that's not the original error.

So I'm wondering, is it possible to make my job show a message box, just like the (python) mount job? Is this a bug in my code or in calamares?

Thanks!

@adriaandegroot
Copy link
Contributor

adriaandegroot commented Dec 18, 2020

The problem is that you're running the job (partitioning) the moment you leave the page. And you log the error result, and then carry on as if nothing is the matter. Normal processing runs jobs in the exec phase, and Calamares knows all about handling errors from jobs in the exec phase. That's where the pop-up comes from, as well as emergency shut-down support and all the rest.

@adriaandegroot
Copy link
Contributor

adriaandegroot commented Dec 18, 2020

The ViewManager does have a method for this, though: onInstallationFailed() so you could do something like:

ViewManager::instance()->onInstallationFailed( res.message(), res.details() );

This kind of fatal error will exit the installer, though.

@ollieparanoid
Copy link
Author

ollieparanoid commented Dec 18, 2020

Aaah, that makes sense. Thanks for the detailed answers!

I'll close this then, not a problem in Calamares.

ollieparanoid added a commit to ollieparanoid/calamares-extensions that referenced this issue Dec 19, 2020
Stop the installation if the partition job does not finish successfully
instead of carrying on and failing later on. While at it, elaborate some
more on why it is necessary to call the partition job early.

Related: calamares/calamares#1600
ollieparanoid added a commit to ollieparanoid/calamares-extensions that referenced this issue Dec 19, 2020
Stop the installation if the partition job does not finish successfully
instead of carrying on and failing later on. While at it, elaborate some
more on why it is necessary to call the partition job early.

Related: calamares/calamares#1600
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

No branches or pull requests

2 participants