statusweather: Catch all exceptions.
This commit is contained in:
parent
8ef801d1df
commit
0977bc557d
|
@ -23,6 +23,7 @@
|
|||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <future>
|
||||
|
@ -193,19 +194,29 @@ void update(std::atomic<bool> &cancelled)
|
|||
|
||||
int main()
|
||||
{
|
||||
// TODO: Implement clean shutdown.
|
||||
std::atomic<bool> cancelled{false};
|
||||
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.
|
||||
try
|
||||
{
|
||||
if (line == "1") // Left mouse button.
|
||||
// TODO: Implement clean shutdown.
|
||||
std::atomic<bool> cancelled{false};
|
||||
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.
|
||||
{
|
||||
if (fetch_weather())
|
||||
if (line == "1") // Left mouse button.
|
||||
{
|
||||
print_weather();
|
||||
if (fetch_weather())
|
||||
{
|
||||
print_weather();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
std::cout << R"(<span color="red">)" << e.what() << "</span>"
|
||||
<< std::endl;
|
||||
return 33;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user