statusweather: Catch all exceptions.

This commit is contained in:
tastytea 2021-08-23 18:35:25 +02:00
parent 8ef801d1df
commit 0977bc557d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 20 additions and 9 deletions

View File

@ -23,6 +23,7 @@
#include <atomic>
#include <chrono>
#include <cstdint>
#include <exception>
#include <fstream>
#include <functional>
#include <future>
@ -192,10 +193,13 @@ void update(std::atomic<bool> &cancelled)
}
int main()
{
try
{
// TODO: Implement clean shutdown.
std::atomic<bool> cancelled{false};
auto future{std::async(std::launch::async, update, std::ref(cancelled))};
auto future{
std::async(std::launch::async, update, std::ref(cancelled))};
std::string line;
while (std::getline(std::cin, line)) // Button click is sent to stdin.
@ -209,3 +213,10 @@ int main()
}
}
}
catch (std::exception &e)
{
std::cout << R"(<span color="red">)" << e.what() << "</span>"
<< std::endl;
return 33;
}
}