For non-recoverable user-facing errors (ie. "Cannot connect to the internet"), is returning a result through a channel to the GUI thread something ok to do? Or should I be handling it differently?
Returning the error through the channel is one reasonable way to handle errors.
That works, but IMO is needlessly complex.
What I would recommend instead:
In the main thread, you want to start all the threads, and then join on the handles of all of them
If you want to get rid of that expect() , you would have to do something like cargo-crev/main.rs at 88b96096b7b996ad64f42f05031c871c67bbd21f · crev-dev/cargo-crev · GitHub to get the panic error message from inside that opaque data structure via downcasting.
Each thread you join on, should be a loop either over channel recv or just checking some atomic boolean flag to make it exit.
If you can't have the thread cleanly stop, just don't join on it.